forked from tdwojak/Python2019
Add labs 02
This commit is contained in:
parent
dd9f37dec1
commit
bbae263dde
405
labs02/Podstawy cz. 2.ipynb
Normal file
405
labs02/Podstawy cz. 2.ipynb
Normal file
@ -0,0 +1,405 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"# Podstawy Pythona: cz. 3\n",
|
||||||
|
"\n",
|
||||||
|
" \n",
|
||||||
|
"\n",
|
||||||
|
"## 27 stycznia 2019"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"## Co już było?\n",
|
||||||
|
" * podstawowe typy danych\n",
|
||||||
|
" * operacje arytmetyczne\n",
|
||||||
|
" * wyświtlanie na ekran\n",
|
||||||
|
" * pętla `for`, instrukcja `if`\n",
|
||||||
|
" * listy i słowniki"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"## Funkcje\n",
|
||||||
|
"\n",
|
||||||
|
" * znamy kilka funkcji, np. print, len\n",
|
||||||
|
" * funckje w pythonie nie odbiegają od funkcji w innych językach\n",
|
||||||
|
" * może istnieć tylko 1 funkcja o danej nazwie"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def nazwa_funkcji(argument1, argument2, argument3):\n",
|
||||||
|
" # instrukcje do wykoniania\n",
|
||||||
|
" return wartosc"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 2,
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"True\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"def is_greater_than_5(x):\n",
|
||||||
|
" if x > 5:\n",
|
||||||
|
" return True\n",
|
||||||
|
" else:\n",
|
||||||
|
" return False\n",
|
||||||
|
" \n",
|
||||||
|
"print(is_greater_than_5(10))"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 7,
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"8.0\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"def srednia(lista):\n",
|
||||||
|
" s = 0\n",
|
||||||
|
" for item in lista:\n",
|
||||||
|
" s += item\n",
|
||||||
|
" return s / len(lista) \n",
|
||||||
|
"\n",
|
||||||
|
"print(srednia([7,8,9]))"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 10,
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def count(lista, item):\n",
|
||||||
|
" l = 0\n",
|
||||||
|
" for i in lista:\n",
|
||||||
|
" if i == item:\n",
|
||||||
|
" l += 1\n",
|
||||||
|
" return l"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 12,
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"3"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 12,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"count([3,3,3,4], 3)\n",
|
||||||
|
"count(lista=[3,3,3,4], item=3)\n",
|
||||||
|
"count(item=3, lista=[3,3,3,4])"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 15,
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def is_grater_than(x, y=0):\n",
|
||||||
|
" if x > y:\n",
|
||||||
|
" return True\n",
|
||||||
|
" else:\n",
|
||||||
|
" return False"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 16,
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"False"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 16,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"is_grater_than(5)\n",
|
||||||
|
"is_grater_than(x=5)\n",
|
||||||
|
"is_grater_than(5, 0)\n",
|
||||||
|
"is_grater_than(5, 6)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 17,
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"['a', 'b', 'c', 'd']\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"def alfaRange(x, y):\n",
|
||||||
|
" for i in range(ord(x), ord(y)):\n",
|
||||||
|
" yield chr(i)\n",
|
||||||
|
"print(list(alfaRange('a', 'e')))"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"## Operacje na plikach"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"plik = open(\"haslo.txt\", 'r')\n",
|
||||||
|
"for linia in plik.readlines():\n",
|
||||||
|
" print(linia.strip())\n",
|
||||||
|
"print(\">>\")\n",
|
||||||
|
"plik.close()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 18,
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"ename": "FileNotFoundError",
|
||||||
|
"evalue": "[Errno 2] No such file or directory: 'haslo.txt'",
|
||||||
|
"output_type": "error",
|
||||||
|
"traceback": [
|
||||||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||||
|
"\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
|
||||||
|
"\u001b[0;32m<ipython-input-18-c98a6e23ed86>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mwith\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"haslo.txt\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'r'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mplik\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mlinia\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mplik\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreadlines\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlinia\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
||||||
|
"\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'haslo.txt'"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"with open(\"haslo.txt\", 'r') as plik:\n",
|
||||||
|
" for linia in plik.readlines():\n",
|
||||||
|
" print(linia)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 19,
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"with open(\"haslo2.txt\", 'w') as plik:\n",
|
||||||
|
" for word in ('corect', 'horse', 'battery', 'staple'):\n",
|
||||||
|
" plik.write(word)\n",
|
||||||
|
" plik.write('\\n')\n",
|
||||||
|
"with open(\"haslo2.txt\", 'w+') as plik:\n",
|
||||||
|
" plik.writelines([' '.join(('corect', 'horse', 'battery', 'staple'))])"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"## Korzystanie z bibliotek"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 20,
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"posix\n",
|
||||||
|
"Nazwa uzytkownika: tomasz\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import os\n",
|
||||||
|
"print(os.name)\n",
|
||||||
|
"\n",
|
||||||
|
"from os import getenv\n",
|
||||||
|
"print('Nazwa uzytkownika: {}'.format(getenv(\"USER\")))"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 21,
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "slide"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Counter({'o': 4, 'n': 4, 'a': 4, 'k': 3, 't': 3, 'y': 2, 'i': 2, 'c': 2, 'z': 2, 's': 1, 'p': 1, 'l': 1, 'ń': 1, 'w': 1, 'e': 1})\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"array([[1., 3., 4., 5.]], dtype=float32)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 21,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"from collections import *\n",
|
||||||
|
"print(Counter(\"konstantynopolitańczykowianeczka\"))\n",
|
||||||
|
"\n",
|
||||||
|
"import numpy as np\n",
|
||||||
|
"np.array([[1, 3, 4, 5]], dtype='float32')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"celltoolbar": "Slideshow",
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Python 3",
|
||||||
|
"language": "python",
|
||||||
|
"name": "python3"
|
||||||
|
},
|
||||||
|
"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.7.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 2
|
||||||
|
}
|
2
labs02/haslo.txt
Normal file
2
labs02/haslo.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
W Paryżu najlepsze kasztany są na placu Pigalle
|
||||||
|
Zuzanna lubi je tylko jesienią.
|
1
labs02/haslo2.txt
Normal file
1
labs02/haslo2.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
corect horse battery staple
|
1
labs02/scores/model.iter10000.npz.bleu
Normal file
1
labs02/scores/model.iter10000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 2.02, 17.1/3.6/1.0/0.3 (BP=1.000, ratio=1.872, hyp_len=80326, ref_len=42903)
|
1
labs02/scores/model.iter100000.npz.bleu
Normal file
1
labs02/scores/model.iter100000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 13.99, 44.4/18.5/9.3/5.0 (BP=1.000, ratio=1.072, hyp_len=45976, ref_len=42903)
|
1
labs02/scores/model.iter110000.npz.bleu
Normal file
1
labs02/scores/model.iter110000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 14.35, 44.9/19.0/9.6/5.2 (BP=1.000, ratio=1.087, hyp_len=46657, ref_len=42903)
|
1
labs02/scores/model.iter120000.npz.bleu
Normal file
1
labs02/scores/model.iter120000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 15.75, 47.1/20.5/10.7/6.0 (BP=1.000, ratio=1.030, hyp_len=44211, ref_len=42903)
|
1
labs02/scores/model.iter130000.npz.bleu
Normal file
1
labs02/scores/model.iter130000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 15.96, 47.7/20.8/10.9/6.0 (BP=1.000, ratio=1.029, hyp_len=44160, ref_len=42903)
|
1
labs02/scores/model.iter140000.npz.bleu
Normal file
1
labs02/scores/model.iter140000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 15.42, 46.8/20.3/10.5/5.7 (BP=1.000, ratio=1.043, hyp_len=44729, ref_len=42903)
|
1
labs02/scores/model.iter150000.npz.bleu
Normal file
1
labs02/scores/model.iter150000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 15.84, 47.3/20.7/10.8/5.9 (BP=1.000, ratio=1.034, hyp_len=44374, ref_len=42903)
|
1
labs02/scores/model.iter160000.npz.bleu
Normal file
1
labs02/scores/model.iter160000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 15.99, 47.7/20.8/10.9/6.0 (BP=1.000, ratio=1.031, hyp_len=44233, ref_len=42903)
|
1
labs02/scores/model.iter170000.npz.bleu
Normal file
1
labs02/scores/model.iter170000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 16.15, 47.9/21.0/11.0/6.1 (BP=1.000, ratio=1.027, hyp_len=44065, ref_len=42903)
|
1
labs02/scores/model.iter180000.npz.bleu
Normal file
1
labs02/scores/model.iter180000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 15.86, 47.1/20.8/10.8/6.0 (BP=1.000, ratio=1.053, hyp_len=45191, ref_len=42903)
|
1
labs02/scores/model.iter190000.npz.bleu
Normal file
1
labs02/scores/model.iter190000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 16.07, 47.7/21.0/11.0/6.0 (BP=1.000, ratio=1.044, hyp_len=44795, ref_len=42903)
|
1
labs02/scores/model.iter20000.npz.bleu
Normal file
1
labs02/scores/model.iter20000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 5.87, 31.1/8.9/3.3/1.3 (BP=1.000, ratio=1.155, hyp_len=49533, ref_len=42903)
|
1
labs02/scores/model.iter200000.npz.bleu
Normal file
1
labs02/scores/model.iter200000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 16.82, 48.9/21.7/11.5/6.6 (BP=0.998, ratio=0.998, hyp_len=42837, ref_len=42903)
|
1
labs02/scores/model.iter210000.npz.bleu
Normal file
1
labs02/scores/model.iter210000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 16.70, 48.7/21.7/11.5/6.4 (BP=1.000, ratio=1.017, hyp_len=43622, ref_len=42903)
|
1
labs02/scores/model.iter220000.npz.bleu
Normal file
1
labs02/scores/model.iter220000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 16.85, 48.9/21.9/11.7/6.5 (BP=1.000, ratio=1.020, hyp_len=43777, ref_len=42903)
|
1
labs02/scores/model.iter230000.npz.bleu
Normal file
1
labs02/scores/model.iter230000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 16.59, 48.3/21.6/11.4/6.3 (BP=1.000, ratio=1.029, hyp_len=44127, ref_len=42903)
|
1
labs02/scores/model.iter240000.npz.bleu
Normal file
1
labs02/scores/model.iter240000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 16.94, 48.6/22.0/11.7/6.6 (BP=1.000, ratio=1.038, hyp_len=44517, ref_len=42903)
|
1
labs02/scores/model.iter250000.npz.bleu
Normal file
1
labs02/scores/model.iter250000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.52, 49.7/22.5/12.2/6.9 (BP=1.000, ratio=1.003, hyp_len=43053, ref_len=42903)
|
1
labs02/scores/model.iter260000.npz.bleu
Normal file
1
labs02/scores/model.iter260000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 16.82, 48.6/21.9/11.6/6.5 (BP=1.000, ratio=1.037, hyp_len=44475, ref_len=42903)
|
1
labs02/scores/model.iter270000.npz.bleu
Normal file
1
labs02/scores/model.iter270000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.16, 49.2/22.3/11.9/6.6 (BP=1.000, ratio=1.025, hyp_len=43965, ref_len=42903)
|
1
labs02/scores/model.iter280000.npz.bleu
Normal file
1
labs02/scores/model.iter280000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 16.92, 49.4/22.1/11.7/6.4 (BP=1.000, ratio=1.013, hyp_len=43453, ref_len=42903)
|
1
labs02/scores/model.iter290000.npz.bleu
Normal file
1
labs02/scores/model.iter290000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.20, 49.2/22.1/11.9/6.8 (BP=1.000, ratio=1.016, hyp_len=43578, ref_len=42903)
|
1
labs02/scores/model.iter30000.npz.bleu
Normal file
1
labs02/scores/model.iter30000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 8.17, 33.9/11.6/5.0/2.3 (BP=1.000, ratio=1.207, hyp_len=51768, ref_len=42903)
|
1
labs02/scores/model.iter300000.npz.bleu
Normal file
1
labs02/scores/model.iter300000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.31, 49.2/22.2/12.0/6.8 (BP=1.000, ratio=1.017, hyp_len=43642, ref_len=42903)
|
1
labs02/scores/model.iter310000.npz.bleu
Normal file
1
labs02/scores/model.iter310000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.57, 49.5/22.5/12.3/7.0 (BP=1.000, ratio=1.000, hyp_len=42900, ref_len=42903)
|
1
labs02/scores/model.iter320000.npz.bleu
Normal file
1
labs02/scores/model.iter320000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.68, 49.6/22.6/12.3/7.1 (BP=1.000, ratio=1.013, hyp_len=43465, ref_len=42903)
|
1
labs02/scores/model.iter330000.npz.bleu
Normal file
1
labs02/scores/model.iter330000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.02, 48.3/21.9/11.8/6.7 (BP=1.000, ratio=1.044, hyp_len=44801, ref_len=42903)
|
1
labs02/scores/model.iter340000.npz.bleu
Normal file
1
labs02/scores/model.iter340000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.51, 49.7/22.7/12.2/6.9 (BP=1.000, ratio=1.011, hyp_len=43368, ref_len=42903)
|
1
labs02/scores/model.iter350000.npz.bleu
Normal file
1
labs02/scores/model.iter350000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.68, 50.3/22.9/12.4/7.0 (BP=0.995, ratio=0.995, hyp_len=42702, ref_len=42903)
|
1
labs02/scores/model.iter360000.npz.bleu
Normal file
1
labs02/scores/model.iter360000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.43, 49.0/22.4/12.2/6.9 (BP=1.000, ratio=1.040, hyp_len=44629, ref_len=42903)
|
1
labs02/scores/model.iter370000.npz.bleu
Normal file
1
labs02/scores/model.iter370000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.16, 49.2/22.2/11.9/6.7 (BP=1.000, ratio=1.028, hyp_len=44085, ref_len=42903)
|
1
labs02/scores/model.iter380000.npz.bleu
Normal file
1
labs02/scores/model.iter380000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.04, 49.1/22.2/11.8/6.6 (BP=1.000, ratio=1.030, hyp_len=44200, ref_len=42903)
|
1
labs02/scores/model.iter390000.npz.bleu
Normal file
1
labs02/scores/model.iter390000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.77, 49.8/22.8/12.4/7.1 (BP=1.000, ratio=1.008, hyp_len=43258, ref_len=42903)
|
1
labs02/scores/model.iter40000.npz.bleu
Normal file
1
labs02/scores/model.iter40000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 8.55, 32.5/11.9/5.3/2.6 (BP=1.000, ratio=1.341, hyp_len=57542, ref_len=42903)
|
1
labs02/scores/model.iter400000.npz.bleu
Normal file
1
labs02/scores/model.iter400000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.96, 50.0/23.0/12.6/7.2 (BP=1.000, ratio=1.002, hyp_len=43009, ref_len=42903)
|
1
labs02/scores/model.iter410000.npz.bleu
Normal file
1
labs02/scores/model.iter410000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.66, 49.6/22.6/12.3/7.0 (BP=1.000, ratio=1.019, hyp_len=43697, ref_len=42903)
|
1
labs02/scores/model.iter420000.npz.bleu
Normal file
1
labs02/scores/model.iter420000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.93, 49.8/23.1/12.6/7.2 (BP=1.000, ratio=1.021, hyp_len=43824, ref_len=42903)
|
1
labs02/scores/model.iter430000.npz.bleu
Normal file
1
labs02/scores/model.iter430000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 16.55, 47.0/21.3/11.5/6.5 (BP=1.000, ratio=1.071, hyp_len=45947, ref_len=42903)
|
1
labs02/scores/model.iter440000.npz.bleu
Normal file
1
labs02/scores/model.iter440000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.59, 49.8/22.7/12.2/6.9 (BP=1.000, ratio=1.009, hyp_len=43301, ref_len=42903)
|
1
labs02/scores/model.iter450000.npz.bleu
Normal file
1
labs02/scores/model.iter450000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.41, 49.2/22.5/12.1/6.9 (BP=1.000, ratio=1.023, hyp_len=43894, ref_len=42903)
|
1
labs02/scores/model.iter460000.npz.bleu
Normal file
1
labs02/scores/model.iter460000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.52, 49.9/22.7/12.2/6.8 (BP=1.000, ratio=1.005, hyp_len=43127, ref_len=42903)
|
1
labs02/scores/model.iter470000.npz.bleu
Normal file
1
labs02/scores/model.iter470000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.30, 49.1/22.3/12.0/6.8 (BP=1.000, ratio=1.024, hyp_len=43917, ref_len=42903)
|
1
labs02/scores/model.iter480000.npz.bleu
Normal file
1
labs02/scores/model.iter480000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.21, 48.8/22.1/12.0/6.8 (BP=1.000, ratio=1.036, hyp_len=44454, ref_len=42903)
|
1
labs02/scores/model.iter490000.npz.bleu
Normal file
1
labs02/scores/model.iter490000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.79, 50.0/22.9/12.4/7.1 (BP=1.000, ratio=1.000, hyp_len=42891, ref_len=42903)
|
1
labs02/scores/model.iter50000.npz.bleu
Normal file
1
labs02/scores/model.iter50000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 11.03, 39.5/15.1/7.1/3.5 (BP=1.000, ratio=1.116, hyp_len=47860, ref_len=42903)
|
1
labs02/scores/model.iter500000.npz.bleu
Normal file
1
labs02/scores/model.iter500000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.25, 49.4/22.3/12.0/6.7 (BP=1.000, ratio=1.014, hyp_len=43517, ref_len=42903)
|
1
labs02/scores/model.iter510000.npz.bleu
Normal file
1
labs02/scores/model.iter510000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.78, 50.0/22.8/12.4/7.1 (BP=1.000, ratio=1.000, hyp_len=42890, ref_len=42903)
|
1
labs02/scores/model.iter520000.npz.bleu
Normal file
1
labs02/scores/model.iter520000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.68, 49.8/22.7/12.4/7.0 (BP=1.000, ratio=1.003, hyp_len=43021, ref_len=42903)
|
1
labs02/scores/model.iter530000.npz.bleu
Normal file
1
labs02/scores/model.iter530000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.31, 48.9/22.3/12.1/6.8 (BP=1.000, ratio=1.032, hyp_len=44262, ref_len=42903)
|
1
labs02/scores/model.iter540000.npz.bleu
Normal file
1
labs02/scores/model.iter540000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.92, 49.8/22.9/12.5/7.2 (BP=1.000, ratio=1.015, hyp_len=43562, ref_len=42903)
|
1
labs02/scores/model.iter550000.npz.bleu
Normal file
1
labs02/scores/model.iter550000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.84, 50.0/22.9/12.5/7.1 (BP=1.000, ratio=1.011, hyp_len=43389, ref_len=42903)
|
1
labs02/scores/model.iter560000.npz.bleu
Normal file
1
labs02/scores/model.iter560000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.75, 49.8/22.8/12.4/7.1 (BP=1.000, ratio=1.014, hyp_len=43494, ref_len=42903)
|
1
labs02/scores/model.iter570000.npz.bleu
Normal file
1
labs02/scores/model.iter570000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.94, 50.0/23.1/12.6/7.1 (BP=1.000, ratio=1.013, hyp_len=43442, ref_len=42903)
|
1
labs02/scores/model.iter580000.npz.bleu
Normal file
1
labs02/scores/model.iter580000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 18.12, 50.3/23.1/12.7/7.3 (BP=1.000, ratio=1.004, hyp_len=43077, ref_len=42903)
|
1
labs02/scores/model.iter590000.npz.bleu
Normal file
1
labs02/scores/model.iter590000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.29, 48.8/22.3/12.1/6.8 (BP=1.000, ratio=1.042, hyp_len=44688, ref_len=42903)
|
1
labs02/scores/model.iter60000.npz.bleu
Normal file
1
labs02/scores/model.iter60000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 11.92, 40.2/16.1/7.8/4.0 (BP=1.000, ratio=1.144, hyp_len=49071, ref_len=42903)
|
1
labs02/scores/model.iter600000.npz.bleu
Normal file
1
labs02/scores/model.iter600000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.46, 49.5/22.5/12.2/6.8 (BP=1.000, ratio=1.026, hyp_len=44035, ref_len=42903)
|
1
labs02/scores/model.iter610000.npz.bleu
Normal file
1
labs02/scores/model.iter610000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 18.19, 50.3/23.2/12.7/7.4 (BP=1.000, ratio=1.007, hyp_len=43221, ref_len=42903)
|
1
labs02/scores/model.iter620000.npz.bleu
Normal file
1
labs02/scores/model.iter620000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 17.84, 50.1/22.9/12.5/7.1 (BP=1.000, ratio=1.016, hyp_len=43604, ref_len=42903)
|
1
labs02/scores/model.iter630000.npz.bleu
Normal file
1
labs02/scores/model.iter630000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 18.30, 50.8/23.4/12.9/7.5 (BP=0.994, ratio=0.994, hyp_len=42632, ref_len=42903)
|
1
labs02/scores/model.iter640000.npz.bleu
Normal file
1
labs02/scores/model.iter640000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 0, 0/0/0/0 (BP=0, ratio=0, hyp_len=0, ref_len=0)
|
1
labs02/scores/model.iter70000.npz.bleu
Normal file
1
labs02/scores/model.iter70000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 12.77, 42.4/17.1/8.4/4.4 (BP=1.000, ratio=1.096, hyp_len=47008, ref_len=42903)
|
1
labs02/scores/model.iter80000.npz.bleu
Normal file
1
labs02/scores/model.iter80000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 14.43, 46.7/19.4/9.7/5.2 (BP=0.988, ratio=0.988, hyp_len=42376, ref_len=42903)
|
1
labs02/scores/model.iter90000.npz.bleu
Normal file
1
labs02/scores/model.iter90000.npz.bleu
Normal file
@ -0,0 +1 @@
|
|||||||
|
BLEU = 13.85, 44.1/18.5/9.2/4.9 (BP=1.000, ratio=1.092, hyp_len=46859, ref_len=42903)
|
88
labs02/zadania_3.py
Normal file
88
labs02/zadania_3.py
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
"""
|
||||||
|
Zadania na rozgrzewkę.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 1
|
||||||
|
* Stwórz listę składającą się z dowolnych 100 elementów, np. może być
|
||||||
|
to listę kwadratów liczb.
|
||||||
|
* Sprawdź za pomocą funkcji len liczbę elementów tej listy.
|
||||||
|
* Usuń trzeci, element.
|
||||||
|
* Usuń przedostatni element.
|
||||||
|
* Wyświetl pierwsze 10 elementów.
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 2
|
||||||
|
Znajdz najmniejsz element w poniższej liście.
|
||||||
|
"""
|
||||||
|
l = [0, 6, 9, -10, -5, 9, 8, -6]
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 3
|
||||||
|
Wyświetl poniższy słownik, tak,, aby każda para klucz: wartość
|
||||||
|
była w osobnej linii.
|
||||||
|
"""
|
||||||
|
s = {'Tomasz': [3, 4, 5, 4], 'Agata': [5, 5, 5, 4]}
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 4
|
||||||
|
Poniżej jest podana lista liczby. Stwórz słownik <counter>, którego kluczami
|
||||||
|
będą wartości występujące w liście <liczby>, a wartościami ile dany element
|
||||||
|
wystąpił w liście <liczby>.
|
||||||
|
"""
|
||||||
|
liczby = [3, 4, 3, 3, 4, 7, 9]
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 5
|
||||||
|
Poniższy słownik oceny dwóch osób. Stwórz nowy słownik z takimi samymi kluczami,
|
||||||
|
ale wartościami tego słownika będą średnie oceń.
|
||||||
|
"""
|
||||||
|
s = {'Tomasz': [3, 4, 5, 4], 'Agata': [5, 5, 5, 4]}
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 6
|
||||||
|
Dla podanego poniże słownika S, stwórz nowy słownik, którego kluczami będą
|
||||||
|
wartości słownika S, a wartościami: odpowiadające im klucze z S.
|
||||||
|
"""
|
||||||
|
S = {'Klucz1': "Wartosc1", 'Klucz2': "Wartosc2", 'Klucz3': "Wartosc3"}
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 7
|
||||||
|
Napisz kod, który wypisze na ekran elementy, które występnują w obu poniżej
|
||||||
|
podanych funkcjach.
|
||||||
|
"""
|
||||||
|
l1 = [99, 8, 7, 55]
|
||||||
|
l2 = [55, 111, 11, 99, 8]
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 8
|
||||||
|
Napisz kod, który znajdzie najdroższy produkt w poniższym słowniku.
|
||||||
|
"""
|
||||||
|
zakupy = {'telefon': 1000, 'ładowarka': 35, 'chleb': 4.30, 'kawa': 55, 'gramofon': 240}
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 9
|
||||||
|
Stwórz listę składającą się z wartości słownika zakupy.
|
||||||
|
"""
|
||||||
|
zakupy = {'telefon': 1000, 'ładowarka': 35, 'chleb': 4.30, 'kawa': 55, 'gramofon': 240}
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 10
|
||||||
|
Wyświetl na ekranie poniższy wzór:
|
||||||
|
*
|
||||||
|
* *
|
||||||
|
* * *
|
||||||
|
* * * *
|
||||||
|
* * * * *
|
||||||
|
* * * *
|
||||||
|
* * *
|
||||||
|
* *
|
||||||
|
*
|
||||||
|
"""
|
49
labs02/zadania_4.py
Normal file
49
labs02/zadania_4.py
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 1
|
||||||
|
Napisz funkcję, która zwróci sumę elementów w liście.
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 2
|
||||||
|
Napisz funkcje, która dla przekazanej listy, zwróci listę z niepowtarzającymi
|
||||||
|
się wartościami.
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 3
|
||||||
|
Napisz funkcję, która dla przekazanej listy zwróci listę skłdajacąs się
|
||||||
|
z elementów na parzystych indeksach.
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 4
|
||||||
|
Napisz funkcję, która sprawdzi, czy podany napis (String) jest palindromem,
|
||||||
|
czyli wyrazem, który czytany od końca jest tym samym słowem, np. kajak.
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 5
|
||||||
|
Napisz generator, który będzie zwracał n kolejnych liczb ciągu fibonacciego,
|
||||||
|
gdzie n to argument funkcji.
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 6
|
||||||
|
Zainstaluj bibliotekę ``weather-api`` (https://pypi.python.org/pypi/weather-api). Korzystając z niej:
|
||||||
|
* Wypisz informacje o aktualnej pogodzie.
|
||||||
|
* Napisz funkcję, która zamieni stopnie ``F`` na ``C``.
|
||||||
|
* Korzystając z prognozy, znajdź dzień, w którym będzie najzimniej. Wypisz nazwę tygodnia (w języku polskim) i temperaturę w C.
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
zad. 7
|
||||||
|
Katalog scores zawiera 64 pliki tekstowe, które posiadają informacje o wysokości miary ``BLEU`` na różnych etapach trenowania modelu. Nazwa każdego pliku na postać ``model.iterXXXXXXX.npz.bleu``, gdzie ``XXXXXXX``, to liczba iteracji.Zaw>
|
||||||
|
* Wykorzystaj bibliotekę ``glob`` (https://docs.python.org/2/library/glob.html)
|
||||||
|
* Wyświetl tylko pełną nazwe pliku (wraz z ścieżką).
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user