markdown
stringlengths
0
1.02M
code
stringlengths
0
832k
output
stringlengths
0
1.02M
license
stringlengths
3
36
path
stringlengths
6
265
repo_name
stringlengths
6
127
Performance of homemade model
plt.figure(figsize=(12,4)) plt.subplot(1,3,1) plt.scatter(xTest[:,0], xTest[:,1], c=labelEst0, cmap=pltcolors.ListedColormap(testColors), marker='x', alpha=0.2); plt.xlabel('x0') plt.ylabel('x1') plt.grid() plt.title('Estimated') cb = plt.colorbar() loc = np.arange(0,1,1./len(testColors)) cb.set_ticks(loc) cb.set_tickl...
Accuracy = 0.9265
MIT
classification/ClassificationContinuous2Features-KNN.ipynb
tonio73/data-science
Precision $p(y = 1 \mid \hat{y} = 1)$
print('Precision =', np.sum(labelTest[labelEst0 == 1])/np.sum(labelEst0))
Precision = 0.9505783385909569
MIT
classification/ClassificationContinuous2Features-KNN.ipynb
tonio73/data-science
Recall$p(\hat{y} = 1 \mid y = 1)$
print('Recall =', np.sum(labelTest[labelEst0 == 1])/np.sum(labelTest))
Recall = 0.900398406374502
MIT
classification/ClassificationContinuous2Features-KNN.ipynb
tonio73/data-science
Confusion matrix
plotConfusionMatrix(labelTest, labelEst0, np.array(['Blue', 'Red'])); print(metrics.classification_report(labelTest, labelEst0))
precision recall f1-score support False 0.90 0.95 0.93 996 True 0.95 0.90 0.92 1004 accuracy 0.93 2000 macro avg 0.93 0.93 0.93 2000 weighted avg 0.93 0.93 0.93 ...
MIT
classification/ClassificationContinuous2Features-KNN.ipynb
tonio73/data-science
This non-parametric model has a the best performance of all models used so far, including the neural network with two layers.The large drawback is the amount of computation for each sample to predict. This method is hardly usable for sample sizes over 10k. Using SciKit LearnReferences:- SciKit documentation- https://s...
model1 = SkKNeighborsClassifier(n_neighbors=k) model1.fit(xTrain, labelTrain) labelEst1 = model1.predict(xTest) print('Accuracy =', model1.score(xTest, labelTest)) plt.hist(labelEst1*1.0, 10, density=True, alpha=0.5) plt.title('Bernouilli parameter =' + str(np.mean(labelEst1)));
_____no_output_____
MIT
classification/ClassificationContinuous2Features-KNN.ipynb
tonio73/data-science
Confusion matrix (plot)
plotConfusionMatrix(labelTest, labelEst1, np.array(['Blue', 'Red']));
_____no_output_____
MIT
classification/ClassificationContinuous2Features-KNN.ipynb
tonio73/data-science
Classification report
print(metrics.classification_report(labelTest, labelEst1))
precision recall f1-score support False 0.90 0.95 0.93 996 True 0.95 0.90 0.92 1004 accuracy 0.93 2000 macro avg 0.93 0.93 0.93 2000 weighted avg 0.93 0.93 0.93 ...
MIT
classification/ClassificationContinuous2Features-KNN.ipynb
tonio73/data-science
ROC curve
logit_roc_auc = metrics.roc_auc_score(labelTest, labelEst1) fpr, tpr, thresholds = metrics.roc_curve(labelTest, model1.predict_proba(xTest)[:,1]) plt.plot(fpr, tpr, label='KNN classification (area = %0.2f)' % logit_roc_auc) plt.plot([0, 1], [0, 1],'r--') plt.xlim([0.0, 1.0]) plt.ylim([0.0, 1.05]) plt.xlabel('False Posi...
_____no_output_____
MIT
classification/ClassificationContinuous2Features-KNN.ipynb
tonio73/data-science
Network DEA function example在此示範如何使用Network DEA函式,並顯示執行後的結果。 ※示範程式碼及csv資料存放於[這裡](https://github.com/wurmen/DEA/tree/master/Functions/network_data%26code),可自行下載測試。
import network_function #載入存放Network DEA函式的py檔(在此檔名為"network_function.py")
_____no_output_____
MIT
Functions/network_data&code/Network_DEA_function_example.ipynb
PO-LAB/DEA
- 將檔案讀成所需格式- X、Z_input存放於network_data_input.csv中,X位於檔案中的2~3行,Z_input位於4~5行- Y、Z_output存放於network_data_output.csv中,Y位於檔案中第2行,Z_output位於3~4行- 該系統共有3個製程,透過csv2dict_for_network_dea()函式進行讀檔,並回傳得到DMU列表及整體系統與各製程產出投入資料,以及製程數
DMU,X,Z_input,p_n=network_function.csv2dict_for_network_dea('network_data_input.csv', v1_range=[2,3], v2_range=[4,5], p_n=3) DMU,Y,Z_output,p_n=network_function.csv2dict_for_network_dea('network_data_output.csv', v1_range=[2,2], v2_range=[3,4], p_n=3)
_____no_output_____
MIT
Functions/network_data&code/Network_DEA_function_example.ipynb
PO-LAB/DEA
- 將上述讀檔程式所轉換後的資料放入network DEA函式中,並將權重下限設為1e-11
network_function.network(DMU,X,Y,Z_input,Z_output,p_n,var_lb=1e-11)
The efficiency of DMU A:0.523 The efficiency and inefficiency of Process 0 for DMU A:1.0000 and 0 The efficiency and inefficiency of Process 1 for DMU A:0.7500 and 0.09091 The efficiency and inefficiency of Process 2 for DMU A:0.3462 and 0.3864 The efficiency of DMU B:0.595 The efficiency and inefficiency of Process 0 ...
MIT
Functions/network_data&code/Network_DEA_function_example.ipynb
PO-LAB/DEA
=====================================================================Compute Phase Slope Index (PSI) in source space for a visual stimulus=====================================================================This example demonstrates how the Phase Slope Index (PSI) [1]_ can be computedin source space based on single tri...
# Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu> # # License: BSD (3-clause) import numpy as np import mne from mne.datasets import sample from mne.minimum_norm import read_inverse_operator, apply_inverse_epochs from mne.connectivity import seed_target_indices, phase_slope_index print(__doc__) data_path = sam...
_____no_output_____
BSD-3-Clause
0.15/_downloads/plot_mne_inverse_psi_visual.ipynb
drammock/mne-tools.github.io
LinkedIn - Get contact from profile **Tags:** linkedin profile contact naas_drivers Input Import library
from naas_drivers import linkedin
_____no_output_____
BSD-3-Clause
LinkedIn/LinkedIn_Get_contact_from_profile.ipynb
vivard/awesome-notebooks
Get your cookiesHow to get your cookies ?
LI_AT = 'YOUR_COOKIE_LI_AT' # EXAMPLE AQFAzQN_PLPR4wAAAXc-FCKmgiMit5FLdY1af3-2 JSESSIONID = 'YOUR_COOKIE_JSESSIONID' # EXAMPLE ajax:8379907400220387585
_____no_output_____
BSD-3-Clause
LinkedIn/LinkedIn_Get_contact_from_profile.ipynb
vivard/awesome-notebooks
Enter profile URL
PROFILE_URL = "PROFILE_URL"
_____no_output_____
BSD-3-Clause
LinkedIn/LinkedIn_Get_contact_from_profile.ipynb
vivard/awesome-notebooks
Model Get the information return in a dataframe.**Available columns :**- PROFILE_URN : LinkedIn unique profile id- PROFILE_ID : LinkedIn public profile id- EMAIL- CONNECTED_AT- BIRTHDATE- TWITER- ADDRESS- WEBSITES- INTERESTS
df = linkedin.connect(LI_AT, JSESSIONID).profile.get_contact(PROFILE_URL)
_____no_output_____
BSD-3-Clause
LinkedIn/LinkedIn_Get_contact_from_profile.ipynb
vivard/awesome-notebooks
Output Display result
df
_____no_output_____
BSD-3-Clause
LinkedIn/LinkedIn_Get_contact_from_profile.ipynb
vivard/awesome-notebooks
Table of Contents
%matplotlib inline import math,sys,os,numpy as np from numpy.random import random from matplotlib import pyplot as plt, rcParams, animation, rc from __future__ import print_function, division from ipywidgets import interact, interactive, fixed from ipywidgets.widgets import * rc('animation', html='html5') rcParams['fig...
_____no_output_____
Apache-2.0
deeplearning1/nbs/sgd-intro.ipynb
shabeer/fastai_courses
📝 Exercise M7.03As with the classification metrics exercise, we will evaluate the regressionmetrics within a cross-validation framework to get familiar with the syntax.We will use the Ames house prices dataset.
import pandas as pd import numpy as np ames_housing = pd.read_csv("../datasets/house_prices.csv") data = ames_housing.drop(columns="SalePrice") target = ames_housing["SalePrice"] data = data.select_dtypes(np.number) target /= 1000
_____no_output_____
CC-BY-4.0
notebooks/metrics_ex_02.ipynb
leonsor/scikit-learn-mooc
NoteIf you want a deeper overview regarding this dataset, you can refer to theAppendix - Datasets description section at the end of this MOOC. The first step will be to create a linear regression model.
# Write your code here. from sklearn.linear_model import LinearRegression linreg = LinearRegression()
_____no_output_____
CC-BY-4.0
notebooks/metrics_ex_02.ipynb
leonsor/scikit-learn-mooc
Then, use the `cross_val_score` to estimate the generalization performance ofthe model. Use a `KFold` cross-validation with 10 folds. Make the use of the$R^2$ score explicit by assigning the parameter `scoring` (even though it isthe default score).
from sklearn.model_selection import cross_val_score scores = cross_val_score(linreg, data, target, cv=10, scoring='r2') print(f"R2 score: {scores.mean():.3f} +/- {scores.std():.3f}") # Write your code here. from sklearn.model_selection import cross_validate result_linreg_r2 = cross_validate(linreg, data, target, cv=10,...
R2 result for linreg: 0.794 +/- 0.109
CC-BY-4.0
notebooks/metrics_ex_02.ipynb
leonsor/scikit-learn-mooc
Then, instead of using the $R^2$ score, use the mean absolute error. You needto refer to the documentation for the `scoring` parameter.
# Write your code here. result_linreg_mae = cross_validate(linreg, data, target, cv=10, scoring="neg_mean_absolute_error") result_reg_mae_df = pd.DataFrame(result_linreg_mae) result_reg_mae_df scores = cross_val_score(linreg, data, target, cv=10, scoring='neg_mean_absolute_error') scores = -scores print(f"Mean Absolute...
Mean Absolute Error result for linreg: 21.892 +/- -2.346
CC-BY-4.0
notebooks/metrics_ex_02.ipynb
leonsor/scikit-learn-mooc
Finally, use the `cross_validate` function and compute multiple scores/errorsat once by passing a list of scorers to the `scoring` parameter. You cancompute the $R^2$ score and the mean absolute error for instance.
# Write your code here. scoring = ["r2", "neg_mean_absolute_error"] result_linreg_duo = cross_validate(linreg, data, target, cv=10, scoring=scoring) scores = {"R2": result_linreg_duo["test_r2"], "MAE": -result_linreg_duo["test_neg_mean_absolute_error"]} scores_df = pd.DataFrame(scores) scores_df result_lin...
_____no_output_____
CC-BY-4.0
notebooks/metrics_ex_02.ipynb
leonsor/scikit-learn-mooc
Flights data preparation
from pyspark.sql import SQLContext from pyspark.sql import DataFrame from pyspark.sql import Row from pyspark.sql.types import * import pandas as pd import StringIO import matplotlib.pyplot as plt hc = sc._jsc.hadoopConfiguration() hc.set("hive.execution.engine", "mr")
_____no_output_____
Apache-2.0
integration-tests/examples/test_templates/jupyter/template_preparation_pyspark.ipynb
AdamsDisturber/incubator-dlab
Function to parse CSV
import csv def parseCsv(csvStr): f = StringIO.StringIO(csvStr) reader = csv.reader(f, delimiter=',') row = reader.next() return row scsv = '"02Q","Titan Airways"' row = parseCsv(scsv) print row[0] print row[1] working_storage = 'WORKING_STORAGE' output_directory = 'jupyter/py2' protocol_name = 'PROTO...
_____no_output_____
Apache-2.0
integration-tests/examples/test_templates/jupyter/template_preparation_pyspark.ipynb
AdamsDisturber/incubator-dlab
Parse and convert Carrier data to parquet
carriersHeader = 'Code,Description' carriersText = sc.textFile(protocol_name + working_storage + "/jupyter_dataset/carriers.csv").filter(lambda x: x != carriersHeader) carriers = carriersText.map(lambda s: parseCsv(s)) \ .map(lambda s: Row(code=s[0], description=s[1])).cache().toDF() carriers.write.mode("overwrite"...
_____no_output_____
Apache-2.0
integration-tests/examples/test_templates/jupyter/template_preparation_pyspark.ipynb
AdamsDisturber/incubator-dlab
Parse and convert to parquet Airport data
airportsHeader= '"iata","airport","city","state","country","lat","long"' airports = sc.textFile(protocol_name + working_storage + "/jupyter_dataset/airports.csv") \ .filter(lambda x: x != airportsHeader) \ .map(lambda s: parseCsv(s)) \ .map(lambda p: Row(iata=p[0], \ airport=p[1], \ ...
_____no_output_____
Apache-2.0
integration-tests/examples/test_templates/jupyter/template_preparation_pyspark.ipynb
AdamsDisturber/incubator-dlab
Parse and convert Flights data to parquet
flightsHeader = 'Year,Month,DayofMonth,DayOfWeek,DepTime,CRSDepTime,ArrTime,CRSArrTime,UniqueCarrier,FlightNum,TailNum,ActualElapsedTime,CRSElapsedTime,AirTime,ArrDelay,DepDelay,Origin,Dest,Distance,TaxiIn,TaxiOut,Cancelled,CancellationCode,Diverted,CarrierDelay,WeatherDelay,NASDelay,SecurityDelay,LateAircraftDelay' fl...
_____no_output_____
Apache-2.0
integration-tests/examples/test_templates/jupyter/template_preparation_pyspark.ipynb
AdamsDisturber/incubator-dlab
# Last amended: 30th March, 2021 # Myfolder: github/hadoop # Objective: # i) Install hadoop on colab # (current version is 3.2.2) # ii) Experiments with hadoop # iii) Install spark on colab # iv) Access hadoop file from spark # v) Install koalas on ...
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
Install hadoopIf it takes too long, it means, it is awaiting input from you regarding overwriting ssh keys Define functionsNo downloads. Just function definitions
# 1.0 How to set environment variable import os import time
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
ssh_install()
# 2.0 Function to install ssh client and sshd (Server) def ssh_install(): print("\n--1. Download and install ssh server----\n") ! sudo apt-get remove openssh-client openssh-server ! sudo apt install openssh-client openssh-server print("\n--2. Restart ssh server----\n") ! service ssh restart
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
Java install
# 3.0 Function to download and install java 8 def install_java(): ! rm -rf /usr/java print("\n--Download and install Java 8----\n") !apt-get install -y openjdk-8-jdk-headless -qq > /dev/null # install openjdk os.environ["JAVA_HOME"] = "/usr/lib/jvm/java-8-openjdk-amd64" # set environment variable ...
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
hadoop install
# 4.0 Function to download and install hadoop def hadoop_install(): print("\n--5. Download hadoop tar.gz----\n") ! wget -c https://mirrors.estointernet.in/apache/hadoop/common/hadoop-3.2.2/hadoop-3.2.2.tar.gz print("\n--6. Transfer downloaded content and unzip tar.gz----\n") ! mv /content/hadoop* /opt/ ! ...
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
hadoop config
# 5.0 Function for setting hadoop configuration def hadoop_config(): print("\n--Begin Configuring hadoop---\n") print("\n=============================\n") print("\n--9. core-site.xml----\n") ! cat /opt/hadoop-3.2.2/etc/hadoop/core-site.xml print("\n--10. Amend core-site.xml----\n") ! echo '<?xml version...
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
ssh keys
# 6.0 Function tp setup ssh passphrase def set_keys(): print("\n---22. Generate SSH keys----\n") ! cd ~ ; pwd ! cd ~ ; ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa ! cd ~ ; cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys ! cd ~ ; chmod 0600 ~/.ssh/authorized_keys
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
Set environment
# 7.0 Function to set up environmental variables def set_env(): print("\n---23. Set Environment variables----\n") # 'export' command does not work in colab # https://stackoverflow.com/a/57240319 os.environ["JAVA_HOME"] = "/usr/lib/jvm/java-8-openjdk-amd64" #set environment variable os.environ["JRE_HOME"] ...
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
Install all function
# 8.0 Function to call all functions def install_hadoop(): print("\n--Install java----\n") ssh_install() install_java() hadoop_install() hadoop_config() set_keys() set_env()
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
Begin installStart downloading, install and configure. Takes around 2 minutes
# 9.0 Start installation start = time.time() install_hadoop() end = time.time() print("\n---Time taken----\n") print((end- start)/60)
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
Format hadoop
# 10.0 Format hadoop print("\n---24. Format namenode----\n") !hdfs namenode -format
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
Start and test hadoopIf namenode is in safemode, use the command: `!hdfs dfsadmin -safemode leave` Start hadoopIf start fails with 'Connection refused', run `ssh_install()` once again
# 11.0 Start namenode # If this fails, run # ssh_install() below # and start hadoop again: print("\n---25. Start namenode----\n") ! start-dfs.sh #ssh_install()
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
Start yarn
# 11.1 Start yarn ! start-yarn.sh
Starting resourcemanager Starting nodemanagers
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
If `start-dfs.sh` fails, issue the following three commands, one after another: `! sudo apt-get remove openssh-client openssh-server``! sudo apt-get install openssh-client openssh-server``! service ssh restart`And then try to start hadoop again, as: `start-dfs.sh` Test hadoopIF in safe mode, leave safe mode as:`!hdfs...
# 11.1 print("\n---26. Make folders in hadoop----\n") ! hdfs dfs -mkdir /user ! hdfs dfs -mkdir /user/ashok # 11.2 Run hadoop commands ! hdfs dfs -ls / ! hdfs dfs -ls /user # 11.3 Stopping hadoop # Gives some errors # But hadoop stops #!stop-dfs.sh
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
Run the `ssh_install()` again if hadoop fails to start with `start-dfs.sh` and then try to start hadoop again. Install spark Define functions `findspark`: PySpark isn't on `sys.path` by default, but that doesn't mean it can't be used as a regular library. You can address this by either symlinking pyspark into your si...
# 1.0 Function to download and unzip spark def spark_koalas_install(): print("\n--1.1 Install findspark----\n") !pip install -q findspark print("\n--1.2 Install databricks Koalas----\n") !pip install koalas print("\n--1.3 Download Apache tar.gz----\n") ! wget -c https://mirrors.estointernet.in/apache/spar...
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
Install spark
# 2.0 Call all the three functions def install_spark(): spark_koalas_install() set_spark_env() spark_conf() # 2.1 install_spark()
--1.1 Install findspark---- --1.2 Install databricks Koalas---- Collecting koalas [?25l Downloading https://files.pythonhosted.org/packages/40/de/87c016a3e5055251ed117c86eb3b0de2381518c7acae54e115711ff30ceb/koalas-1.7.0-py3-none-any.whl (1.4MB)  |████████████████████████████████| 1.4MB 5.6MB/s [?25hRequi...
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
Test sparkHadoop should have been started Call some libraries
# 3.0 Just call some libraries to test import pandas as pd import numpy as np # 3.1 Get spark in sys.path import findspark findspark.init() # 3.2 Call other spark libraries # Just to test from pyspark.sql import SparkSession import databricks.koalas as ks from pyspark.ml.feature import VectorAssembler from pyspar...
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
Test KoalasHadoop should have been started Create a koalas dataframe
# 6.0 # If namenode is in safemode, first use: # hdfs dfsadmin -safemode leave kdf = ks.DataFrame( { 'a': [1, 2, 3, 4, 5, 6], 'b': [100, 200, 300, 400, 500, 600], 'c': ["one", "two", "three", "four", "five", "six"] ...
_____no_output_____
MIT
hadoop & spark/hadoop_spark_install_on_Colab.ipynb
harnalashok/hadoop
OBJECTFPredire $\rho$, $\sigma_a$ et $\sigma_c$ en fonction de $E_r$, $F_r$, et $T_r$ a droite du domaine en toute temps PREPARATION Les imports
%reset -f import matplotlib.pyplot as plt import numpy as np import pandas as pd from ast import literal_eval as l_eval np.set_printoptions(precision = 3)
_____no_output_____
MIT
src/notebook/.ipynb_checkpoints/reseaux_de_neurones-checkpoint.ipynb
desmond-rn/projet-inverse
Chargement des donnees
# """ VERSION COLAB """ # # to load data from my personal github repo (update it if we have to) # import os # if not os.path.exists("assets"): # print("Data wansn't here. Let's download it!") # !git clone https://github.com/desmond-rn/assets.git # else: # print("Data already here. Let's update it!") # ...
Volume in drive C has no label. Volume Serial Number is 2248-85E1 Directory of C:\Users\Roussel\Dropbox\Unistra\SEMESTRE 2\Projet & Stage\Inverse\REPO\data 21-Jun-20 12:53 PM <DIR> . 21-Jun-20 12:53 PM <DIR> .. 21-Jun-20 12:53 PM <DIR> anim 24-Jun-20 02:07 PM 14,8...
MIT
src/notebook/.ipynb_checkpoints/reseaux_de_neurones-checkpoint.ipynb
desmond-rn/projet-inverse
Donnees temporelles
types = {'rho_expr':str, 'sigma_a_expr':str, 'sigma_c_expr':str, 'E_x_0_expr':str, 'F_x_0_expr':str, 'T_x_0_expr':str} converters={'t':l_eval, 'E_l':l_eval, 'F_l':l_eval, 'T_l':l_eval, 'E_r':l_eval, 'F_r':l_eval, 'T_r':l_eval} # on veut convertir les str en listes df_t = pd.read_csv(df_t_path, thousands=',', dtyp...
_____no_output_____
MIT
src/notebook/.ipynb_checkpoints/reseaux_de_neurones-checkpoint.ipynb
desmond-rn/projet-inverse
Donnees spatiales
types = {'rho_expr':str, 'sigma_a_expr':str, 'sigma_c_expr':str, 'E_x_0_expr':str, 'F_x_0_expr':str, 'T_x_0_expr':str} converters={'x':l_eval, 'rho':l_eval, 'sigma_a':l_eval, 'sigma_c':l_eval, 'E_0':l_eval, 'F_0':l_eval, 'T_0':l_eval, 'E':l_eval, 'F':l_eval, 'T':l_eval} df_s = pd.read_csv(df_s_path, thousands=',', dty...
_____no_output_____
MIT
src/notebook/.ipynb_checkpoints/reseaux_de_neurones-checkpoint.ipynb
desmond-rn/projet-inverse
Prerequis pour cet apprentissage Tous les unputs doivent etre similaires sur un certain nombre de leurs parametres.
t_f = 0.005 x_min = 0 x_max = 1 for i in range(len(df_t)): assert df_t.loc[i, 't_f'] == 0.005 assert df_t.loc[i, 'E_0_expr'] == "0.01372*(5^4)" # etc... assert df_t.loc[i, 'x_min'] == x_min assert df_t.loc[i, 'x_max'] == x_max
_____no_output_____
MIT
src/notebook/.ipynb_checkpoints/reseaux_de_neurones-checkpoint.ipynb
desmond-rn/projet-inverse
Visualisation
""" Visualisons les signaux sur la droite et la densite sur le domaine """ def plot_inputs(ax, df_t, index): t = np.array(df_t.loc[index, 't']) # inputs E_r = np.array(df_t.loc[index, 'E_r']) F_r = np.array(df_t.loc[index, 'F_r']) T_r = np.array(df_t.loc[index, 'T_r']) # plot ax[0].p...
_____no_output_____
MIT
src/notebook/.ipynb_checkpoints/reseaux_de_neurones-checkpoint.ipynb
desmond-rn/projet-inverse
Creation des inputs X Pour chacun des signaux E_r, F_r et T_r, il faut tout d'abord:- Tronquer le signal pour ne ne garder que la fin- Reechantilloner le signal pour ne garder que 20, voir 50 pas de temps
""" Permet de couper le debut du signal, parite toujours constante. Retourne la fraction de fin """ def trim(input, ratio): len_input = len(input) len_output = int(len_input*ratio) return input[len_input-len_output:] """ Fonction pour extraire n pas d'iterations """ def resample(input, len_output): len...
X shape = (103, 3, 20)
MIT
src/notebook/.ipynb_checkpoints/reseaux_de_neurones-checkpoint.ipynb
desmond-rn/projet-inverse
Creations des outputs y Pour le signal rho, il faut tout d'abord:- Detecter la position, la hauteur et la larrgeur de chaque crenau
""" Calcule les decalages a droite et a gauche d'un signal """ def decay(signal): signal_right = np.zeros_like(signal) signal_right[1:] = signal[:-1] signal_right[0] = signal[0] signal_left = np.zeros_like(signal) signal_left[:-1] = signal[1:] signal_left[-1] = signal[-1] return signal...
y shape = (103, 3)
MIT
src/notebook/.ipynb_checkpoints/reseaux_de_neurones-checkpoint.ipynb
desmond-rn/projet-inverse
Separation des donnees train, test et val
len_train, len_val = 60, 20 X_train = X[:len_train] X_val = X[len_train:len_train+len_val] X_test = X[len_train+len_val:] y_train = y[:len_train] y_val = y[len_train:len_train+len_val] y_test = y[len_train+len_val:] print("X shapes =", np.shape(X_train), np.shape(X_val), np.shape(X_test)) print("y shapes =", np.shap...
X shapes = (60, 3, 20) (20, 3, 20) (23, 3, 20) y shapes = (60, 3) (20, 3) (23, 3)
MIT
src/notebook/.ipynb_checkpoints/reseaux_de_neurones-checkpoint.ipynb
desmond-rn/projet-inverse
Testen via de Python moduleWe hebben hiervoor nodig `directory`; een map met data om te valideren, deze bestaat uit:* een map `datasets` met daarin 1 of meerdere GeoPackages met HyDAMO lagen* een bestand `validation_rules.json` met daarin de validatieregelsOmdat we op de HyDAMO objecten de maaiveldhoogte willen bepale...
coverage = {"AHN": r"../tests/data/dtm"} directory = r"../tests/data/tasks/test_profielen"
_____no_output_____
MIT
notebooks/test_profielen.ipynb
d2hydro/HyDAMOValidatieModule
We importeren de validator en maken een HyDAMO validator aan die geopackages, csvs en geojsons weg schrijft. We kennen ook de coverage toe.
from hydamo_validation import validator hydamo_validator = validator(output_types=["geopackage", "csv", "geojson"], coverages=coverage, log_level="INFO")
_____no_output_____
MIT
notebooks/test_profielen.ipynb
d2hydro/HyDAMOValidatieModule
Nu kunnen we onze `directory` gaan valideren. Dat duurt ongeveer 20-30 seconden
datamodel, layer_summary, result_summary = hydamo_validator(directory=directory, raise_error=True)
profielgroep is empty (!) INFO:hydamo_validation.validator:finished in 3.58 seconds
MIT
notebooks/test_profielen.ipynb
d2hydro/HyDAMOValidatieModule
We kijken naar de samenvatting van het resultaat
result_summary.to_dict()
_____no_output_____
MIT
notebooks/test_profielen.ipynb
d2hydro/HyDAMOValidatieModule
Phase 3 - deployment This notebook will provide and overview how to deploy and predict the CPE in two ways- The model was build/export in the last notebook (Phase_2_Advanced_Analytics__predictions) This notebook show another option to save/export the model using the H2O flow UI and complement the information with depl...
from IPython.display import Image Image(filename='./data/H2O-FLOW-UI-GBM-MODEL.PNG') from IPython.display import Image Image(filename='./data/H2O-FLOW-UI-GBM-MODEL-download.PNG')
_____no_output_____
MIT
Marketing_Campaign_optimization/bin/Phase_3_Deployment_options.ipynb
ThiagoBarsante/DataScience_projects
Sample of new campaigns to be predicted
import pandas as pd df = pd.read_csv('./GBM_MODEL/New_campaings_for_predictions.csv') df.tail(10)
_____no_output_____
MIT
Marketing_Campaign_optimization/bin/Phase_3_Deployment_options.ipynb
ThiagoBarsante/DataScience_projects
Important attention point- All information will be provided for prediction (base information available in the simulated/demo data) however just the relevant information were used during the model build detailed in the Notebook: Phase_2_Advanced_Analytics__predictions - For example LineItemsID is just an index number...
## To generate prediction (CPE) for new data just run the command ## EXAMPLE ## java -Xmx4g -XX:ReservedCodeCacheSize=256m -cp <h2o-genmodel.jar_EXPORTED_ABOVE> hex.genmodel.tools.PredictCsv --mojo <GBM_log_CPE_model.zip_EXPORTED_ABOVE> --input INPUT_FILE_FOR_PREDICTION.csv --output OUTUPUT_FILE_WITH_PREDICTIONS_FOR_C...
_____no_output_____
MIT
Marketing_Campaign_optimization/bin/Phase_3_Deployment_options.ipynb
ThiagoBarsante/DataScience_projects
Sincronize all information - new campaign data and new predictions for CPE- Remember that the prediction was done in logarithmic scale and now is necessary to rever the result with exponential function
CPE_predictions = pd.read_csv('./GBM_MODEL/New_campaings_for_predictions__EXPORT_EXPORT_PREDICTIONS.csv') CPE_predictions.tail() import numpy as np df['CPE_predition_LOG'] = CPE_predictions['predict'] df['CPE_predition'] = round(np.exp(CPE_predictions['predict']) -1, 3) df.tail()
_____no_output_____
MIT
Marketing_Campaign_optimization/bin/Phase_3_Deployment_options.ipynb
ThiagoBarsante/DataScience_projects
Online prediction: Generate prediction for new data The online prediction could be implemented using diferent architectures such as1. Serverless function such as Amazon AWS Lambda + API Gateway https://aws.amazon.com/lambda/?nc2=h_ql_prod_fs_lbd 2. Java program that use POJO/MOJO model for online prediction http://...
from IPython.display import Image Image(filename='./data/Online-Prediction.PNG')
_____no_output_____
MIT
Marketing_Campaign_optimization/bin/Phase_3_Deployment_options.ipynb
ThiagoBarsante/DataScience_projects
Comprehensive Example
# Enabling the `widget` backend. # This requires jupyter-matplotlib a.k.a. ipympl. # ipympl can be install via pip or conda. %matplotlib widget import matplotlib.pyplot as plt import numpy as np # Testing matplotlib interactions with a simple plot fig = plt.figure() plt.plot(np.sin(np.linspace(0, 20, 100))); # Always ...
_____no_output_____
BSD-3-Clause
docs/examples/full-example.ipynb
martinRenou/jupyter-matplotlib
You can also call `display` on `fig.canvas` to display the interactive plot anywhere in the notebooke
fig.canvas.toolbar_visible = True display(fig.canvas)
_____no_output_____
BSD-3-Clause
docs/examples/full-example.ipynb
martinRenou/jupyter-matplotlib
Or you can `display(fig)` to embed the current plot as a png
display(fig)
_____no_output_____
BSD-3-Clause
docs/examples/full-example.ipynb
martinRenou/jupyter-matplotlib
3D plotting
from mpl_toolkits.mplot3d import axes3d fig = plt.figure() ax = fig.add_subplot(111, projection='3d') # Grab some test data. X, Y, Z = axes3d.get_test_data(0.05) # Plot a basic wireframe. ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) plt.show()
_____no_output_____
BSD-3-Clause
docs/examples/full-example.ipynb
martinRenou/jupyter-matplotlib
Subplots
# A more complex example from the matplotlib gallery np.random.seed(0) n_bins = 10 x = np.random.randn(1000, 3) fig, axes = plt.subplots(nrows=2, ncols=2) ax0, ax1, ax2, ax3 = axes.flatten() colors = ['red', 'tan', 'lime'] ax0.hist(x, n_bins, density=1, histtype='bar', color=colors, label=colors) ax0.legend(prop={'s...
_____no_output_____
BSD-3-Clause
docs/examples/full-example.ipynb
martinRenou/jupyter-matplotlib
Interactions with other widgets and layoutingWhen you want to embed the figure into a layout of other widgets you should call `plt.ioff()` before creating the figure otherwise `plt.figure()` will trigger a display of the canvas automatically and outside of your layout. Without using `ioff`Here we will end up with th...
import ipywidgets as widgets # ensure we are interactive mode # this is default but if this notebook is executed out of order it may have been turned off plt.ion() fig = plt.figure() ax = fig.gca() ax.imshow(Z) widgets.AppLayout( center=fig.canvas, footer=widgets.Button(icon='check'), pane_heights=[0, 6...
_____no_output_____
BSD-3-Clause
docs/examples/full-example.ipynb
martinRenou/jupyter-matplotlib
Fixing the double display with `ioff`If we make sure interactive mode is off when we create the figure then the figure will only display where we want it to.There is ongoing work to allow usage of `ioff` as a context manager, see the [ipympl issue](https://github.com/matplotlib/ipympl/issues/220) and the [matplotlib i...
plt.ioff() fig = plt.figure() plt.ion() ax = fig.gca() ax.imshow(Z) widgets.AppLayout( center=fig.canvas, footer=widgets.Button(icon='check'), pane_heights=[0, 6, 1] )
_____no_output_____
BSD-3-Clause
docs/examples/full-example.ipynb
martinRenou/jupyter-matplotlib
Interacting with other widgets Changing a line plot with a slide
# When using the `widget` backend from ipympl, # fig.canvas is a proper Jupyter interactive widget, which can be embedded in # an ipywidgets layout. See https://ipywidgets.readthedocs.io/en/stable/examples/Layout%20Templates.html # One can bound figure attributes to other widget values. from ipywidgets import AppLayou...
_____no_output_____
BSD-3-Clause
docs/examples/full-example.ipynb
martinRenou/jupyter-matplotlib
Update image data in a performant mannerTwo useful tricks to improve performance when updating an image displayed with matplolib are to:1. Use the `set_data` method instead of calling imshow2. Precompute and then index the array
# precomputing all images x = np.linspace(0,np.pi,200) y = np.linspace(0,10,200) X,Y = np.meshgrid(x,y) parameter = np.linspace(-5,5) example_image_stack = np.sin(X)[None,:,:]+np.exp(np.cos(Y[None,:,:]*parameter[:,None,None])) plt.ioff() fig = plt.figure() plt.ion() im = plt.imshow(example_image_stack[0]) def update(c...
_____no_output_____
BSD-3-Clause
docs/examples/full-example.ipynb
martinRenou/jupyter-matplotlib
Debugging widget updates and matplotlib callbacksIf an error is raised in the `update` function then will not always display in the notebook which can make debugging difficult. This same issue is also true for matplotlib callbacks on user events such as mousemovement, for example see [issue](https://github.com/matplot...
plt.ioff() fig = plt.figure() plt.ion() im = plt.imshow(example_image_stack[0]) out = widgets.Output() @out.capture() def update(change): with out: if change['name'] == 'value': im.set_data(example_image_stack[change['new']]) fig.canvas.draw_idle slider = widgets.IntSlider...
_____no_output_____
BSD-3-Clause
docs/examples/full-example.ipynb
martinRenou/jupyter-matplotlib
Lambda School Data Science*Unit 2, Sprint 3, Module 1*--- Wrangle ML datasets- [ ] Continue to clean and explore your data. - [ ] For the evaluation metric you chose, what score would you get just by guessing?- [ ] Can you make a fast, first model that beats guessing?**We recommend that you use your portfolio project ...
!wget 'https://raw.githubusercontent.com/washingtonpost/data-school-shootings/master/school-shootings-data.csv' import pandas as pd df = pd.read_csv('school-shootings-data.csv') print(df.shape) df.head() # Replace shooting type with 'other' for rows not 'targeted' or 'indiscriminate' df['shooting_type'] = df['shooti...
Test Accuracy: 0.5416666666666666
MIT
module2-wrangle-ml-datasets/LS_DS12_232_assignment.ipynb
jdz014/DS-Unit-2-Applied-Modeling
Interactive single compartment HH exampleTo run this interactive Jupyter Notebook, please click on the rocket icon 🚀 in the top panel. For more information, please see {ref}`how to use this documentation `. Please uncomment the line below if you use the Google Colab. (It does not include these packages by default).
#%pip install pyneuroml neuromllite NEURON import math from neuroml import NeuroMLDocument from neuroml import Cell from neuroml import IonChannelHH from neuroml import GateHHRates from neuroml import BiophysicalProperties from neuroml import MembraneProperties from neuroml import ChannelDensity from neuroml import HHR...
_____no_output_____
CC-BY-4.0
source/Userdocs/NML2_examples/HH_single_compartment.ipynb
NeuroML/Documentation
Declare the model Create ion channels
def create_na_channel(): """Create the Na channel. This will create the Na channel and save it to a file. It will also validate this file. returns: name of the created file """ na_channel = IonChannelHH(id="na_channel", notes="Sodium channel for HH cell", conductance="10pS", species="na") ...
_____no_output_____
CC-BY-4.0
source/Userdocs/NML2_examples/HH_single_compartment.ipynb
NeuroML/Documentation
Create cell
def create_cell(): """Create the cell. :returns: name of the cell nml file """ # Create the nml file and add the ion channels hh_cell_doc = NeuroMLDocument(id="cell", notes="HH cell") hh_cell_fn = "HH_example_cell.nml" hh_cell_doc.includes.append(IncludeType(href=create_na_channel())) h...
_____no_output_____
CC-BY-4.0
source/Userdocs/NML2_examples/HH_single_compartment.ipynb
NeuroML/Documentation
Create a network
def create_network(): """Create the network :returns: name of network nml file """ net_doc = NeuroMLDocument(id="network", notes="HH cell network") net_doc_fn = "HH_example_net.nml" net_doc.includes.append(IncludeType(href=create_cell())) # Create a population:...
_____no_output_____
CC-BY-4.0
source/Userdocs/NML2_examples/HH_single_compartment.ipynb
NeuroML/Documentation
Plot the data we record
def plot_data(sim_id): """Plot the sim data. Load the data from the file and plot the graph for the membrane potential using the pynml generate_plot utility function. :sim_id: ID of simulaton """ data_array = np.loadtxt(sim_id + ".dat") pynml.generate_plot([data_array[:, 0]], [data_array[...
_____no_output_____
CC-BY-4.0
source/Userdocs/NML2_examples/HH_single_compartment.ipynb
NeuroML/Documentation
Create and run the simulationCreate the simulation, run it, record data, and plot the recorded information.
def main(): """Main function Include the NeuroML model into a LEMS simulation file, run it, plot some data. """ # Simulation bits sim_id = "HH_single_compartment_example_sim" simulation = LEMSSimulation(sim_id=sim_id, duration=300, dt=0.01, simulation_seed=123) # Include the NeuroML mod...
pyNeuroML >>> Written LEMS Simulation HH_single_compartment_example_sim to file: LEMS_HH_single_compartment_example_sim.xml pyNeuroML >>> Generating plot: Membrane potential
CC-BY-4.0
source/Userdocs/NML2_examples/HH_single_compartment.ipynb
NeuroML/Documentation
Amazon SageMaker Feature Store: Encrypt Data in your Online or Offline Feature Store using KMS key This notebook demonstrates how to enable encyption for your data in your online or offline Feature Store using KMS key. We start by showing how to programmatically create a KMS key, and how to apply it to the feature sto...
import sagemaker import sys import boto3 import pandas as pd import numpy as np import json original_version = sagemaker.__version__ %pip install 'sagemaker>=2.0.0'
_____no_output_____
Apache-2.0
sagemaker-featurestore/feature_store_kms_key_encryption.ipynb
Amirosimani/amazon-sagemaker-examples
Set up
sagemaker_session = sagemaker.Session() s3_bucket_name = sagemaker_session.default_bucket() prefix = "sagemaker-featurestore-kms-demo" role = sagemaker.get_execution_role() region = sagemaker_session.boto_region_name
_____no_output_____
Apache-2.0
sagemaker-featurestore/feature_store_kms_key_encryption.ipynb
Amirosimani/amazon-sagemaker-examples
Create a KMS client using boto3. Note that you can access your boto session through your sagemaker session, e.g.,`sagemaker_session`.
kms = sagemaker_session.boto_session.client("kms")
_____no_output_____
Apache-2.0
sagemaker-featurestore/feature_store_kms_key_encryption.ipynb
Amirosimani/amazon-sagemaker-examples
KMS Policy TemplateBelow is the policy template you will use for creating a KMS key. You will specify your role to grant it access to various KMS operations that will be used in the back-end for encrypting your data in your Online or Offline Feature Store. **Note**: You will need to substitute your Account number in f...
policy = { "Version": "2012-10-17", "Id": "key-policy-feature-store", "Statement": [ { "Sid": "Allow access through Amazon SageMaker Feature Store for all principals in the account that are authorized to use Amazon SageMaker Feature Store", "Effect": "Allow", "Pri...
_____no_output_____
Apache-2.0
sagemaker-featurestore/feature_store_kms_key_encryption.ipynb
Amirosimani/amazon-sagemaker-examples
Create your new KMS key using the policy above and your KMS client.
try: new_kms_key = kms.create_key( Policy=json.dumps(policy), Description="string", KeyUsage="ENCRYPT_DECRYPT", CustomerMasterKeySpec="SYMMETRIC_DEFAULT", Origin="AWS_KMS", ) AliasName = "my-new-kms-key" ## provide a unique alias name kms.create_alias( Al...
_____no_output_____
Apache-2.0
sagemaker-featurestore/feature_store_kms_key_encryption.ipynb
Amirosimani/amazon-sagemaker-examples
Now that we have our KMS key created and the necessary operations added to our role, we now load in our data.
customer_data = pd.read_csv("data/feature_store_introduction_customer.csv") orders_data = pd.read_csv("data/feature_store_introduction_orders.csv") customer_data.head() orders_data.head() customer_data.dtypes orders_data.dtypes
_____no_output_____
Apache-2.0
sagemaker-featurestore/feature_store_kms_key_encryption.ipynb
Amirosimani/amazon-sagemaker-examples
Creating Feature GroupsWe first start by creating feature group names for customer_data and orders_data. Following this, we create two Feature Groups, one for customer_dat and another for orders_data
from time import gmtime, strftime, sleep customers_feature_group_name = "customers-feature-group-" + strftime("%d-%H-%M-%S", gmtime()) orders_feature_group_name = "orders-feature-group-" + strftime("%d-%H-%M-%S", gmtime())
_____no_output_____
Apache-2.0
sagemaker-featurestore/feature_store_kms_key_encryption.ipynb
Amirosimani/amazon-sagemaker-examples
Instantiate a FeatureGroup object for customers_data and orders_data.
from sagemaker.feature_store.feature_group import FeatureGroup customers_feature_group = FeatureGroup( name=customers_feature_group_name, sagemaker_session=sagemaker_session ) orders_feature_group = FeatureGroup( name=orders_feature_group_name, sagemaker_session=sagemaker_session ) import time current_time_se...
_____no_output_____
Apache-2.0
sagemaker-featurestore/feature_store_kms_key_encryption.ipynb
Amirosimani/amazon-sagemaker-examples
Append EventTime feature to your data frame. This parameter is required, and time stamps each data point.
customer_data["EventTime"] = pd.Series([current_time_sec] * len(customer_data), dtype="float64") orders_data["EventTime"] = pd.Series([current_time_sec] * len(orders_data), dtype="float64") customer_data.head() orders_data.head()
_____no_output_____
Apache-2.0
sagemaker-featurestore/feature_store_kms_key_encryption.ipynb
Amirosimani/amazon-sagemaker-examples
Load feature definitions to your feature group.
customers_feature_group.load_feature_definitions(data_frame=customer_data) orders_feature_group.load_feature_definitions(data_frame=orders_data)
_____no_output_____
Apache-2.0
sagemaker-featurestore/feature_store_kms_key_encryption.ipynb
Amirosimani/amazon-sagemaker-examples
How to create an Online or Offline Feature Store that uses your KMS key for encryption?Below we create two feature groups, `customers_feature_group` and `orders_feature_group` respectively, and explain how use your KMS key to securely encrypt your data in your online or offline feature store. How to create an Online ...
customers_feature_group.create( s3_uri=f"s3://{s3_bucket_name}/{prefix}", record_identifier_name=record_identifier_feature_name, event_time_feature_name="EventTime", role_arn=role, enable_online_store=False, offline_store_kms_key_id="arn:aws:kms:us-east-1:123456789012:key/" + new_kms_key["Ke...
_____no_output_____
Apache-2.0
sagemaker-featurestore/feature_store_kms_key_encryption.ipynb
Amirosimani/amazon-sagemaker-examples
How to verify that your KMS key is being used to encrypt your data in your Online or Offline Feature Store? Online Store VerificationTo demonstrate that your data is being encrypted in your Online store, use your `kms` client from `boto3` to list the grants under your KMS key. It should show 'SageMakerFeatureStore-' ...
kms.list_grants( KeyId="arn:aws:kms:us-east-1:123456789012:key/" + new_kms_key["KeyMetadata"]["KeyId"] )
_____no_output_____
Apache-2.0
sagemaker-featurestore/feature_store_kms_key_encryption.ipynb
Amirosimani/amazon-sagemaker-examples
Clean Up ResourcesRemove the Feature Groups we created.
customers_feature_group.delete() orders_feature_group.delete() # preserve original sagemaker version %pip install 'sagemaker=={}'.format(original_version)
_____no_output_____
Apache-2.0
sagemaker-featurestore/feature_store_kms_key_encryption.ipynb
Amirosimani/amazon-sagemaker-examples
Hyperparameter tuningIn the previous section, we did not discuss the parameters of random forestand gradient-boosting. However, there are a couple of things to keep in mindwhen setting these.This notebook gives crucial information regarding how to set thehyperparameters of both random forest and gradient boosting deci...
from sklearn.datasets import fetch_california_housing from sklearn.model_selection import train_test_split data, target = fetch_california_housing(return_X_y=True, as_frame=True) target *= 100 # rescale the target in k$ data_train, data_test, target_train, target_test = train_test_split( data, target, random_stat...
_____no_output_____
CC-BY-4.0
notebooks/ensemble_hyperparameters.ipynb
lesteve/scikit-learn-mooc
We can observe that in our grid-search, the largest `max_depth` togetherwith the largest `n_estimators` led to the best generalization performance. Gradient-boosting decision treesFor gradient-boosting, parameters are coupled, so we cannot set theparameters one after the other anymore. The important parameters are`n_es...
from sklearn.ensemble import GradientBoostingRegressor param_grid = { "n_estimators": [10, 30, 50], "max_depth": [3, 5, None], "learning_rate": [0.1, 1], } grid_search = GridSearchCV( GradientBoostingRegressor(), param_grid=param_grid, scoring="neg_mean_absolute_error", n_jobs=2 ) grid_search.fit(d...
_____no_output_____
CC-BY-4.0
notebooks/ensemble_hyperparameters.ipynb
lesteve/scikit-learn-mooc
Germany: SK Mainz (Rheinland-Pfalz)* Homepage of project: https://oscovida.github.io* Plots are explained at http://oscovida.github.io/plots.html* [Execute this Jupyter Notebook using myBinder](https://mybinder.org/v2/gh/oscovida/binder/master?filepath=ipynb/Germany-Rheinland-Pfalz-SK-Mainz.ipynb)
import datetime import time start = datetime.datetime.now() print(f"Notebook executed on: {start.strftime('%d/%m/%Y %H:%M:%S%Z')} {time.tzname[time.daylight]}") %config InlineBackend.figure_formats = ['svg'] from oscovida import * overview(country="Germany", subregion="SK Mainz", weeks=5); overview(country="Germany", ...
_____no_output_____
CC-BY-4.0
ipynb/Germany-Rheinland-Pfalz-SK-Mainz.ipynb
oscovida/oscovida.github.io
Explore the data in your web browser- If you want to execute this notebook, [click here to use myBinder](https://mybinder.org/v2/gh/oscovida/binder/master?filepath=ipynb/Germany-Rheinland-Pfalz-SK-Mainz.ipynb)- and wait (~1 to 2 minutes)- Then press SHIFT+RETURN to advance code cell to code cell- See http://jupyter.or...
print(f"Download of data from Johns Hopkins university: cases at {fetch_cases_last_execution()} and " f"deaths at {fetch_deaths_last_execution()}.") # to force a fresh download of data, run "clear_cache()" print(f"Notebook execution took: {datetime.datetime.now()-start}")
_____no_output_____
CC-BY-4.0
ipynb/Germany-Rheinland-Pfalz-SK-Mainz.ipynb
oscovida/oscovida.github.io
Auto assume puan kam
case_1 =['มะนาวต่างดุ๊ด', 'กาเป็นหมู', 'ก้างใหญ่', 'อะหรี่ดอย', 'นอนแล้ว', 'ตะปู', 'นักเรียน', 'ขนม', 'เรอทัก', 'สวัสดี', ['เป็ด','กิน','ไก่'], 'ภูมิหล่อ'] for k in case_1: print('input: ',k) print('output: ',puan_ka...
input: มะนาวต่างดุ๊ด output: [['มุด', 'นาว', 'ต่าง', 'ด๊ะ'], ['มะ', 'นุด', 'ต่าง', 'ดาว']] =========== input: กาเป็นหมู output: ['กู', 'เป็น', 'หมา'] =========== input: ก้างใหญ่ output: ['ใก้', 'หญ่าง'] =========== input: อะหรี่ดอย output: ['อะ', 'หร่อย', 'ดี'] =========== input: นอนแล้ว output: ['แนว', 'ล้อน...
MIT
notebooks/Example.ipynb
Theerit/kampuan_api
Puan all case
for k in case_1: print(k) print(puan_kam_all(k)) print('===========')
มะนาวต่างดุ๊ด {0: ['มุด', 'นาว', 'ต่าง', 'ด๊ะ'], 1: ['มะ', 'นุด', 'ต่าง', 'ดาว']} =========== กาเป็นหมู {0: ['กู', 'เป็น', 'หมา'], 1: ['กา', 'ปู', 'เหม็น']} =========== ก้างใหญ่ {0: ['ใก้', 'หญ่าง'], 1: ['ใก้', 'หญ่าง']} =========== อะหรี่ดอย {0: ['ออย', 'หรี่', 'ดะ'], 1: ['อะ', 'หร่อย', 'ดี']} =========== นอนแล้ว {0: ...
MIT
notebooks/Example.ipynb
Theerit/kampuan_api