diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8aa185a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +.ipynb_checkpoints + diff --git a/RyutaShimogauchi/README.md b/RyutaShimogauchi/README.md new file mode 100644 index 0000000..16f35c7 --- /dev/null +++ b/RyutaShimogauchi/README.md @@ -0,0 +1,22 @@ +# python\_challenge +python\_challengeの実装です. + +## Introduction +###名前 +下垣内 隆太 + +###大学名 +東京大学 + +###専攻 +工学部電子情報工学科 + +### 今までの開発経験 +あまりgithubには上げていませんが[自分のアカウント](https://github.com/rysmarie?tab=repositories)を見てください. +高専に在籍していたときの卒研で作成したプログラムが[このリポジトリ](https://github.com/kcct-fujimotolab/3DCNN)に上がっています. +ディープラーニングのライブラリ・フレームワークはTensorFlow, Chainer, Kerasを使ったことがあります. + +### 中間的な目標 +インターンシップに参加し, 自分がどの程度できるのかを確かめることが現段階での目標です. +また, 論文をもっと読み実装することも目標としており, 確率統計や英語の勉強をしています. + diff --git a/RyutaShimogauchi/Ryuta_Shimogauchi.ipynb b/RyutaShimogauchi/Ryuta_Shimogauchi.ipynb new file mode 100644 index 0000000..8cc2258 --- /dev/null +++ b/RyutaShimogauchi/Ryuta_Shimogauchi.ipynb @@ -0,0 +1,293 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Liaro python_challenge" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 課題1\n", + "1〜10の数字を含むリストを作成する." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "listFrom1to10 = list(range(1, 11))\n", + "listFrom1to10" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 課題2\n", + "1〜10の偶数のみを含むリストを作成する." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[2, 4, 6, 8, 10]" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "evenFrom1to10 = list(range(2, 11, 2))\n", + "evenFrom1to10" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 課題3\n", + "[\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"]というリストがある前提で{0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e', 5: 'f'}を作成する." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e', 5: 'f'}" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "alphabets = ['a', 'b', 'c', 'd', 'e', 'f']\n", + "intAlphDict = {i: a for i, a in enumerate(alphabets)}\n", + "intAlphDict" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 課題4\n", + "以下のようなHumanクラスを作成する.\n", + "- 属性として名前, 年齢, 性別, 身長, 体重を持つ.\n", + "- 年齢をインクリメントするインスタンスメソッドを持つ.\n", + "- 作成したインスタンスをカウントするクラスメソッドを持つ(インスタンス作成時にカウントするように実装してください).\n", + "\n", + "以下の内容を行う. \n", + "{\"山田\", 23歳, 男, 170.3cm, 60.2kg}, {\"高橋\", 30歳, 女, 165.2cm, 46.2kg}の二つのインスタンスを作成 \n", + "どちらかの年齢をインクリメント" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "counter value:1\n", + "山田:\n", + "\tage:23\n", + "\tsex:male\n", + "\theight:170.3\n", + "\tweight:60.2\n", + "\n", + "counter value:2\n", + "高橋:\n", + "\tage:30\n", + "\tsex:female\n", + "\theight:165.2\n", + "\tweight:46.2\n", + "\n", + "increment 山田's age.\n", + "山田:\n", + "\tage:24\n", + "\tsex:male\n", + "\theight:170.3\n", + "\tweight:60.2\n", + "\n" + ] + } + ], + "source": [ + "class Human():\n", + " counter = 0\n", + "\n", + " def __init__(self, name, age, sex, height, weight):\n", + " self.name = name\n", + " self.age = age\n", + " self.sex = sex\n", + " self.height = height\n", + " self.weight = weight\n", + " self.incrementCounter()\n", + "\n", + " def incrementAge(self):\n", + " self.age += 1\n", + "\n", + " def incrementCounter(self):\n", + " Human.counter += 1\n", + " \n", + "\n", + "Yamada = Human(\"山田\", 23, \"male\", 170.3, 60.2)\n", + "print('counter value:{}'.format(Human.counter))\n", + "print('{0.name}:\\n\\tage:{0.age}\\n\\tsex:{0.sex}\\n\\theight:{0.height}\\n\\tweight:{0.weight}\\n'.format(Yamada))\n", + "Takahashi = Human(\"高橋\", 30, \"female\", 165.2, 46.2)\n", + "print('counter value:{}'.format(Human.counter))\n", + "print('{0.name}:\\n\\tage:{0.age}\\n\\tsex:{0.sex}\\n\\theight:{0.height}\\n\\tweight:{0.weight}\\n'.format(Takahashi))\n", + "Yamada.incrementAge()\n", + "print(\"increment {}'s age.\".format(Yamada.name))\n", + "print('{0.name}:\\n\\tage:{0.age}\\n\\tsex:{0.sex}\\n\\theight:{0.height}\\n\\tweight:{0.weight}\\n'.format(Yamada))\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 課題5\n", + "numpyを用いて自分で自由に作った二つの行列の積を計算する." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import numpy as np" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[19, 7, 91],\n", + " [ 8, 57, 50],\n", + " [15, 45, 87]])" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "A = np.random.randint(0, 10, (3, 3))\n", + "B = np.random.randint(0, 10, (3, 3))\n", + "np.matmul(A, B)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 課題6\n", + "numpyを用いて自分で自由に作った二つのベクトルのcosを計算する." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a=[8 2 3 5 5]\n", + "b=[2 4 4 3 6]\n", + "cos of a and b is 0.7986208584745025.\n" + ] + } + ], + "source": [ + "a = np.random.randint(1, 10, 5)\n", + "b = np.random.randint(1, 10, 5)\n", + "c = np.dot(a, b) / (np.linalg.norm(a)*np.linalg.norm(b))\n", + "print('a={}\\nb={}\\ncos of a and b is {}.'.format(a, b, c))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "anaconda-cloud": {}, + "kernelspec": { + "display_name": "Python [Root]", + "language": "python", + "name": "Python [Root]" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.5.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/RyutaShimogauchi/assignment.py b/RyutaShimogauchi/assignment.py new file mode 100644 index 0000000..4580317 --- /dev/null +++ b/RyutaShimogauchi/assignment.py @@ -0,0 +1,69 @@ +import numpy as np + + +def assignment1(): + listFrom1to10 = list(range(1, 11)) + print('{}'.format(listFrom1to10)) + + +def assignment2(): + evenFrom1to10 = list(range(2, 11, 2)) + print('{}'.format(evenFrom1to10)) + + +def assignment3(): + alphabets = ['a', 'b', 'c', 'd', 'e', 'f'] + intAlphDict = {i: a for i, a in enumerate(alphabets)} + print('{}'.format(intAlphDict)) + + +class Human(): + counter = 0 + + def __init__(self, name, age, sex, height, weight): + self.name = name + self.age = age + self.sex = sex + self.height = height + self.weight = weight + self.incrementCounter() + + def incrementAge(self): + self.age += 1 + + def incrementCounter(self): + Human.counter += 1 + + +def assignment4(): + Yamada = Human("山田", 23, "male", 170.3, 60.2) + print('counter value:{}'.format(Human.counter)) + print('{0.name}:\n\tage:{0.age}\n\tsex:{0.sex}\n\theight:{0.height}\n\tweight:{0.weight}\n'.format(Yamada)) + Takahashi = Human("高橋", 30, "female", 165.2, 46.2) + print('counter value:{}'.format(Human.counter)) + print('{0.name}:\n\tage:{0.age}\n\tsex:{0.sex}\n\theight:{0.height}\n\tweight:{0.weight}\n'.format(Takahashi)) + Yamada.incrementAge() + print("increment {}'s age.".format(Yamada.name)) + print('{0.name}:\n\tage:{0.age}\n\tsex:{0.sex}\n\theight:{0.height}\n\tweight:{0.weight}\n'.format(Yamada)) + + +def assignment5(): + A = np.random.randint(0, 10, (3, 3)) + B = np.random.randint(0, 10, (3, 3)) + C = np.matmul(A, B) + print('A={}\nB={}\nA*B=\n{}'.format(A, B, C)) + + +def assignment6(): + a = np.random.randint(1, 10, 5) + b = np.random.randint(1, 10, 5) + c = np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b)) + print('a={}\nb={}\ncos of a and b is {}.'.format(a, b, c)) + +if __name__ == '__main__': + assignment1() + assignment2() + assignment3() + assignment4() + assignment5() + assignment6()