text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python import os for dirname, _, filenames in os.walk('/kaggle/input'): for filename in filenames: print(os.path.join(dirname, filename)...
github_jupyter
# exma quick start In this tutorial we will take the typical molecular dynamics case of a Lennard-Jones (LJ) fluid, in its solid phase and in its liquid phase, and we will see how to obtain different properties of them using this library. This first part of the code will be common to all three sections. We are going ...
github_jupyter
<h1> Scaling up ML using Cloud ML Engine </h1> In this notebook, we take a previously developed TensorFlow model to predict taxifare rides and package it up so that it can be run in Cloud MLE. For now, we'll run this on a small dataset. The model that was developed is rather simplistic, and therefore, the accuracy of ...
github_jupyter
# Train-validation tagging This notebook shows how to split a training dataset into train and validation folds using tags **Input**: - Source project - Train-validation split ratio **Output**: - New project with images randomly tagged by `train` or `val`, based on split ration ## Configuration Edit the following s...
github_jupyter
## Train GPT on addition Train a GPT model on a dedicated addition dataset to see if a Transformer can learn to add. ``` # set up logging import logging logging.basicConfig( format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", datefmt="%m/%d/%Y %H:%M:%S", level=logging.INFO, ) # ma...
github_jupyter
# Demo 1: a demo based on visual-92-categories-task MEG data Here is a demo based on the publicly available visual-92-categories-task MEG datasets. (Reference: Cichy, R. M., Pantazis, D., & Oliva, A. “Resolving human object recognition in space and time.” Nature neuroscience (2014): 17(3), 455-462.) MNE-Python has bee...
github_jupyter
# Detailed Steps Example #### This notebook demonstrates how the data cleaning, peak fitting and descriptors generation works step by step, serving as a detailed example of the `ProcessData_PlotDescriptors_Examples.ipynb`. ## Packages and Needed Python Files Preparation ### First we import packages we need: ``` impo...
github_jupyter
# Indexing Okay guys today's lecture is indexing. > What is indexing? At heart, indexing is the ability to inspect a value inside a object. So basically if we have a list, X, of 100 items and our index is 'i' then 'i of X' returns the *ith value* inside the list (p.s. we can index strings too). Okay, so what is t...
github_jupyter
``` from fastai.text.all import * chunked?? ``` Let's look at how long it takes to tokenize a sample of 1000 IMDB review. ``` path = untar_data(URLs.IMDB_SAMPLE) df = pd.read_csv(path/'texts.csv') df.head(2) ss = L(list(df.text)) ss[0] ``` We'll start with the simplest approach: ``` def delim_tok(s, delim=' '): ret...
github_jupyter
# Lab 05 : Train with mini-batches -- solution ``` # For Google Colaboratory import sys, os if 'google.colab' in sys.modules: # mount google drive from google.colab import drive drive.mount('/content/gdrive') # find automatically the path of the folder containing "file_name" : file_name = 'minibatc...
github_jupyter
# Lab 3 - Distance Metrics and Clustering ### Non-Euclidean Distance Metrics We are most familiar with the typical Euclidian distance metric, ie: given two vectors $\overline{v_1} = [x_1, y_1]$ and $\overline{v_2} = [x_2, y_2]$, the distance $D$ between them is $\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$. This is generali...
github_jupyter
# Deep $Q$-learning In this notebook, we'll build a neural network that can learn to play games through reinforcement learning. More specifically, we'll use $Q$-learning to train an agent to play a game called [Cart-Pole](https://gym.openai.com/envs/CartPole-v0). In this game, a freely swinging pole is attached to a c...
github_jupyter
## Week 2 Optional Thoery Discussion The following problems are for those of you looking to challenge yourself beyond the required problem sets and programming questions. Most of these have been given in Stanford's CS161 course, Design and Analysis of Algorithms, at some point. They are completely optional and will no...
github_jupyter
# Multi-Label Classification Tutorial This tutorial shows how to use Tribuo's MultiLabel package to perform [multi-label classification](https://en.wikipedia.org/wiki/Multi-label_classification) tasks. Multi-label classification is the task of assigning a *set* of labels to a given example from a specific label domain...
github_jupyter
# Copying an ArcGIS StoryMap item to another organization ## Introduction Esri provides two models for telling stories with maps: The [Classic Story Map](https://storymaps-classic.arcgis.com/en/) and the newer [ArcGIS StoryMap](https://www.esri.com/en-us/arcgis/products/arcgis-storymaps/overview). Each offers the inf...
github_jupyter
# 实战 Kaggle 比赛:图像分类 (CIFAR-10) :label:`sec_kaggle_cifar10` 之前几节中,我们一直在使用深度学习框架的高级API直接获取张量格式的图像数据集。 但是在实践中,图像数据集通常以图像文件的形式出现。 在本节中,我们将从原始图像文件开始,然后逐步组织、读取并将它们转换为张量格式。 我们在 :numref:`sec_image_augmentation`中对CIFAR-10数据集做了一个实验。CIFAR-10是计算机视觉领域中的一个重要的数据集。 在本节中,我们将运用我们在前几节中学到的知识来参加CIFAR-10图像分类问题的Kaggle竞赛,(**比赛的网址是https://ww...
github_jupyter
# Assignment 1 Welcome to the first programming assigment for the course. This assignments will help to familiarise you with qiskit while revisiting the topics discussed in this week's lectures. ### Submission Guidelines For final submission, and to ensure that you have no errors in your solution, please use the 'Res...
github_jupyter
``` import pandas as pd import numpy as np import csv f = open('find inter thres_300.csv', 'rt') reader = csv.reader(f) data_list = [] for line in reader: data_list.append(line) f.close() find_inter_thres_300 = pd.DataFrame(data_list) new_col = ['rep', 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55...
github_jupyter
### Regression results ``` import numpy as np import tensorflow as tf tf.logging.set_verbosity(tf.logging.ERROR) import tensorflow.contrib.slim as slim import matplotlib.pyplot as plt %matplotlib inline %config InlineBackend.figure_format = 'retina' from cn_reg_class import cn_reg_class from mlp_reg_class import mlp...
github_jupyter
``` from mayavi import mlab mlab.init_notebook() from pyscf import gto, scf, lo import numpy as np from functools import reduce from pyscf.lo.orth import pre_orth_ao_atm_scf import ase, scipy from pyscf import lo import itertools as itl import ase.visualize as av T,F=True,False np.set_printoptions(precision=2,suppress...
github_jupyter
## Text Classification using torchflare. *** * Dataset: https://www.kaggle.com/columbine/imdb-dataset-sentiment-analysis-in-csv-format ``` import pandas as pd import numpy as np import torch import torch.nn as nn from sklearn.model_selection import train_test_split import transformers import torchflare.metrics as m...
github_jupyter
<img src="https://raw.githubusercontent.com/google/jax/main/images/jax_logo_250px.png" width="300" height="300" align="center"/><br> Welcome to another JAX tutorial. I hope you all have been enjoying the JAX Tutorials so far. We have already completed three tutorials on JAX each of which introduced an important concep...
github_jupyter
# pyGemPick Tutorial 3: Outputing Detected Gold Particle Centers ## How to Output Gold Particle Centers To Use In Future Spatial-Statistical Analysis of Gold Particle Cross Correlation In this tutorial we'll be using the **bin2df( )** function found in the pygempick.spatialstats package to record the x,y centers of e...
github_jupyter
# <font color='blue'>Monte Carlo Simulation</font> # <font color='blue'>Monte Carlo Simulation and Time Series for Financial Modeling</font> ### Loading the Packages ``` # Python Version from platform import python_version print('Python Version:', python_version()) # Imports for data manipulation import numpy as np ...
github_jupyter
## 2020년 2월 6일 금요일 ### 백준 6588번: 골드바흐의 추측문제 ### 문제 : https://www.acmicpc.net/problem/6588 ### 블로그 : https://somjang.tistory.com/entry/BaeKJoon-6588%EB%B2%88-%EA%B3%A8%EB%93%9C%EB%B0%94%ED%9D%90%EC%9D%98-%EC%B6%94%EC%B8%A1-%EB%AC%B8%EC%A0%9C-%ED%92%80%EC%9D%B4 ### 첫번째 시도 먼저 입력 받은 수보다 작은 소수를 모두 구하고 가장 큰 소수와 가장 작은 소수와 더한...
github_jupyter
# Transforms and Multi-Table Relational Databases * This notebook shows how to run transforms directly on a mutli-table relational database while keeping the referential integrity of primary and foreign keys intact. * This notebook also contains instructions on how to transform data residing in CSV files. * Primary and...
github_jupyter
<a href="https://colab.research.google.com/github/yohanesnuwara/reservoir-engineering/blob/master/Unit%203%20Reservoir%20Statics/notebook/3_examples.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # **Unit 3 Reservoir Statics (Examples)** ``` impor...
github_jupyter
# Fitting BERT Classifier to Twitter MBTI ``` import tensorflow as tf import torch from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler from sklearn.model_selection import train_test_split from transformers import BertTokenizer, BertConfig from transformers import AdamW, BertForSequ...
github_jupyter
``` import pandas as pd import numpy as np import seaborn as sns from google.colab import drive from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from sklearn.ensemble import GradientBoostingClassifier from sklearn.metrics import classification_report, plot_confu...
github_jupyter
``` # from google.colab import drive # drive.mount('/content/drive') import torch.nn as nn import torch.nn.functional as F import pandas as pd import numpy as np import matplotlib.pyplot as plt import torch import torchvision import torchvision.transforms as transforms from torch.utils.data import Dataset, DataLoader...
github_jupyter
# Josephson Junction QComponent Demo Notebook This demo notebook describes two types of Josephson Junction (JJ) qcomponents available in Qiskit Metal, including a "Manhattan"-style JJ and a "Dolan"-style JJ. In addition, we demonstrate how to insert these realistic JJ structures in between the capacative pads of the t...
github_jupyter
# データサイエンス100本ノック(構造化データ加工編) - SQL ## はじめに - データベースはPostgreSQL13です - 初めに以下のセルを実行してください - セルに %%sql と記載することでSQLを発行することができます - jupyterからはdescribeコマンドによるテーブル構造の確認ができないため、テーブル構造を確認する場合はlimitを指定したSELECTなどで代用してください - 使い慣れたSQLクライアントを使っても問題ありません(接続情報は以下の通り) - IPアドレス:Docker Desktopの場合はlocalhost、Docker toolboxの場合は192.168.99.1...
github_jupyter
``` %load_ext autoreload %autoreload 2 # %matplotlib notebook import numpy as np import matplotlib.pyplot as plt import src.solver_helper as helper from src.traffic_world import TrafficWorld from src.car_plotting_multiple import plot_multiple_cars, plot_cars, animate, plot_single_frame from src.multiagent_mpc import Mu...
github_jupyter
``` import os import sys import gym from gym import wrappers, logger import gridworld import random import numpy as np import matplotlib.pyplot as plt import matplotlib matplotlib.use("TkAgg") import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from collections import nam...
github_jupyter
# Getting started with ReColorAdv This file contains instructions for experimenting with the ReColorAdv attack, by itself and combined with other attacks. This tutorial is based on the [first tutorial](https://github.com/revbucket/mister_ed/blob/master/notebooks/tutorial_1.ipynb) of `mister_ed`. See the README to make ...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
# Classical Music Recommendation Playground This notebook will show how to implement simple recommender system follwing two different approaches: **Collaborative Filtering** (user based) and **Content Based** recommendation. > DISCLAIMER: > The used dataset is NOT a real dataset, but it has been artificially generate...
github_jupyter
``` import numpy as np class LinearRegression: def __init__(self, fit_intercept=True): self.coef_ = None self.intercept_ = None self._fit_intercept = fit_intercept def fit(self, X, y): """Fit model coefficients. Arguments: X -- 1D or 2D numpy array ...
github_jupyter
``` import numpy import imp from re import sub import logging from datetime import datetime, timedelta import matplotlib.pyplot as plt import numpy as np import seaborn as sns import os try: changed except NameError: os.chdir('..') os.system('find -name *.pyc | xargs rm') changed = True import sys std...
github_jupyter
``` import pandas as pd import numpy as np import os import re ``` # Encoding of categorical variables In this notebook, we will present typical ways of dealing with **categorical variables** by encoding them, namely **ordinal encoding** and **one-hot encoding**. Let us first load the entire adult dataset containin...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df=pd.read_csv('only_road_accidents_data3.csv') df.head() print(df['STATE/UT'].unique()) df2=df[df.columns[2:10]].sum(axis=0) #print(df2) df2.plot.pie(title='Time slot distribution of all accidents in India(2001-14)',autopc...
github_jupyter
# Description A Colab notebook for generating images using OpenAI's CLIP model. Heavily influenced by Alexander Mordvintsev's Deep Dream, this work uses CLIP to match an image learned by a SIREN network with a given textual description. As a good launching point for future directions and to find more related w...
github_jupyter
## Load Data ``` !wget http://ai.stanford.edu/~amaas/data/sentiment/aclImdb_v1.tar.gz !tar xfz ./aclImdb_v1.tar.gz import os import numpy as np def get_files(dir): return [dir + d for d in os.listdir(dir) if os.path.isfile(dir + d)] train_dir = '/content/aclImdb/train/' test_dir = '/content/aclImdb/test/' train_p...
github_jupyter
#Part 4 BERT for arithmetic sentiment analysis Acknowledgement: We used most of the code from https://mccormickml.com/2019/07/22/BERT-fine-tuning/ Most Credit to: Chris McCormick and Nick Ryan # Bert Background **B**idirectional **E**ncoder **R**epresentations from **T**ransformers (BERT) [Devlin et al., 2019]...
github_jupyter
## 第4章 Matplotlibでグラフを 描画しよう ### 4-7: 箱ひげ図 ``` import matplotlib.pyplot as plt # リスト4.7.1:箱ひげ図の描画 plt.style.use("ggplot") x = [1, 2, 3, 3, 11, 20] fig = plt.figure() ax = fig.add_subplot(111) ax.boxplot(x) plt.show() # リスト4.7.2:複数の箱ひげ図の描画 # 複数のリストをリストにセット x = [[1, 2, 3, 3, 11, 20], [1, 2, 9, 10, 15, 16]] labels = ["A...
github_jupyter
# Stochastic Gradient Descent Regression This Code template is for regression analysis using the simple SGDRegressor based on the Stochastic Gradient Descent approach. ### Required Packages ``` import warnings import numpy as np import pandas as pd import seaborn as se import matplotlib.pyplot as plt from s...
github_jupyter
<a href="https://colab.research.google.com/github/keithvtls/Numerical-Method-Activities/blob/main/Lecture/Week%2015%20-%20Numerical%20Integration/NuMeth_6_Numerical_Integration.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Numerical Integration ...
github_jupyter
# Geopandas ``` import pandas as pd import geopandas as gpd import matplotlib.pyplot as plt import cartopy # Cargar el mapa mapa = gpd.read_file('data/provincias.geojson') mapa.head(10) mapa.plot() natalidad = pd.read_csv('data/natalidad.csv') natalidad.head() mapa_data = pd.merge(mapa, natalidad, left_on='NAME_2', ri...
github_jupyter
# Intro to Python Data Structures Lists, Tuples, Sets, Dicts (c) 2019 Joe James ## Sequences: String, List, Tuple **** **indexing** - access any item in the sequence using its index. Indexing starts with 0 for the first element. ``` # string x = 'frog' print (x[3]) # list x = ['pig', 'cow', 'horse'] print (x[1]...
github_jupyter
``` import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torchvision.transforms as transforms import torchvision.datasets as datasets import torchvision.models.vgg as vgg import torchvision.models.resnet as resnet import ocd device = 'cuda' if torch.cuda.is_avail...
github_jupyter
``` # Import pyNBS modules from pyNBS import data_import_tools as dit from pyNBS import network_propagation as prop from pyNBS import pyNBS_core as core from pyNBS import pyNBS_single from pyNBS import consensus_clustering as cc from pyNBS import pyNBS_plotting as plot # Import other needed packages import os import t...
github_jupyter
# 6 - Transformers for Sentiment Analysis In this notebook we will be using the transformer model, first introduced in [this](https://arxiv.org/abs/1706.03762) paper. Specifically, we will be using the BERT (Bidirectional Encoder Representations from Transformers) model from [this](https://arxiv.org/abs/1810.04805) pa...
github_jupyter
# FKLearn Tutorial: * <font size="4"> FKlearn is the nubank functional library for Machine Learning </font> * <font size="4"> It was created with the idea of scaling machine learning through the company by standardizing model development and implementing an easy interface to allow all users to develop the best prac...
github_jupyter
``` %matplotlib inline import os import csv import codecs import numpy as np import pandas as pd import matplotlib.image as mpimg import matplotlib.pyplot as plt from sklearn.utils import shuffle from sklearn.model_selection import StratifiedKFold from sklearn.metrics import log_loss import datetime seed = 111 np.rand...
github_jupyter
``` # Install the latest Tensorflow version. !pip3 install --quiet "tensorflow>=1.7" # Install TF-Hub. !pip3 install --quiet "tensorflow-hub>=0.7.0" !pip3 install --quiet seaborn from absl import logging import tensorflow.compat.v1 as tf import tensorflow_hub as hub import matplotlib.pyplot as plt import numpy as np i...
github_jupyter
# Machine Learning Engineer Nanodegree ## Supervised Learning ## Project 2: Building a Student Intervention System Welcome to the second project of the Machine Learning Engineer Nanodegree! In this notebook, some template code has already been provided for you, and it will be your job to implement the additional funct...
github_jupyter
# Machine Learning Part I ## 1. Introduction ### 1.1 What is Machine Learning? [Machine learning](https://en.wikipedia.org/wiki/Machine_learning) was described by Arthur Samuel as the "field of study that gives computers the ability to learn without being explicitly programmed". The following three principles are c...
github_jupyter
# CStreet: a computed <ins>C</ins>ell <ins>S</ins>tate <ins>tr</ins>ajectory inf<ins>e</ins>r<ins>e</ins>nce method for <ins>t</ins>ime-series single-cell RNA-seq data ## This is a tutorial written using Jupyter Notebook. ### Step 1. CStreet installation following the [tutorial](https://github.com/yw-Hua/CStreet). #...
github_jupyter
# RadarCOVID-Report ## Data Extraction ``` import datetime import logging import os import shutil import tempfile import textwrap import uuid import dataframe_image as dfi import matplotlib.ticker import numpy as np import pandas as pd import seaborn as sns %matplotlib inline sns.set() matplotlib.rcParams['figure.f...
github_jupyter
# D&D Name generator ``` %matplotlib inline import os import sys PROJECT_ROOT = os.path.dirname(os.getcwd()) sys.path.append(PROJECT_ROOT) from collections import defaultdict import numpy as np import matplotlib.pyplot as plt from data import DnDCharacterNameDataset from train import RNNLayerTrainer from generator ...
github_jupyter
``` import json import time import sys import pandas as pd import numpy as np import scipy.sparse as sp import pickle as pkl import collections import gc with open('../data/index_item_map.pkl', 'rb') as f: data_map = pkl.load(f) paper_id_title = data_map['paper_id_title'] author_id_name = data_map['author_id_name...
github_jupyter
``` """ Convert netCDF files to geotiff. Update 2019 06 26: rerun using updated inundation layers Author: Rutger Hofste Date: 20180816 Kernel: python35 Docker: rutgerhofste/gisdocker:ubuntu16.04 Args: TESTING (boolean) : Toggle testing mode SCRIPT_NAME (string) : Script name OUTPUT_VERSION (integer) : o...
github_jupyter
# Temporal Difference: On-policy n-Tuple Sarsa, Stochastic ``` import numpy as np ``` ## Create environment ``` def create_environment_states(): """Creates environment states. Returns: num_states: int, number of states. num_terminal_states: int, number of terminal states. num_non_ter...
github_jupyter
# Classification on Iris dataset with sklearn and DJL In this notebook, you will try to use a pre-trained sklearn model to run on DJL for a general classification task. The model was trained with [Iris flower dataset](https://en.wikipedia.org/wiki/Iris_flower_data_set). ## Background ### Iris Dataset The dataset c...
github_jupyter
<a href="https://colab.research.google.com/github/martin-fabbri/colab-notebooks/blob/master/deeplearning.ai/tf/trax_ner_reformer.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # NER Reformer ## Named Entity Recognition Named-entity recognition ...
github_jupyter
# Transfer Learning In this notebook, you'll learn how to use pre-trained networks to solved challenging problems in computer vision. Specifically, you'll use networks trained on [ImageNet](http://www.image-net.org/) [available from torchvision](http://pytorch.org/docs/0.3.0/torchvision/models.html). ImageNet is a m...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt a = np.zeros(3, dtype=int) a z = np.zeros(10) print(z) print(z.shape) z.shape = (10,1) print(z) z = np.zeros(4) z.shape = (2,2) print(z) z = np.zeros((2,2)) print(z) z = np.ones((2,3)) print(z) z = np.empty((3,3)) print(z) z = np.identity(3) print(z) blalist = [222...
github_jupyter
``` #IMPORT SEMUA LIBARARY #IMPORT LIBRARY PANDAS import pandas as pd #IMPORT LIBRARY UNTUK POSTGRE from sqlalchemy import create_engine import psycopg2 #IMPORT LIBRARY CHART from matplotlib import pyplot as plt from matplotlib import style #IMPORT LIBRARY BASE PATH import os import io #IMPORT LIBARARY PDF from fpdf im...
github_jupyter
# ECCB2020 Tutorial T05: Computational modelling of cellular processes: regulatory vs metabolic systems ## Part 3: Introductions to constrainat-based modeling using cobrapy ### Instructors: * Miguel Ponce de León from (Barcelona Supercomputing Center) * Marta Cascante (Universidad de Barcelona) 1 Septembar, 2020 ``...
github_jupyter
# Particle Filter on Episode 千葉工業大学 上田 隆一 (c) 2017 Ryuichi Ueda This software is released under the MIT License, see LICENSE. ## はじめに このコードは、上田が https://link.springer.com/chapter/10.1007/978-3-319-48036-7_54 で公表した「particle filter on episode」というアルゴリズムです。簡単なタスクを学習できますが、まだ弱いです。 ``` %matplotlib inline import numpy as...
github_jupyter
# Backtesting Sentiment Pairs <b>Summary: </b> <br> For rolling average and rolling standard deviation of the lenght 7 days, NLP was calcualted for all possible combinations. A trading fee was assumed 0.0075 (taken from Bitmex). Calculations show that the best pairs are Bots/Whitepaper, Announcement/Bearish, Shilling/...
github_jupyter
# Hybrid quantum-classical Neural Networks with PyTorch and Qiskit Machine learning (ML) has established itself as a successful interdisciplinary field which seeks to mathematically extract generalizable information from data. Throwing in quantum computing gives rise to interesting areas of research which seek to leve...
github_jupyter
``` !curl -o datasets 'https://ftp.ncbi.nlm.nih.gov/pub/datasets/command-line/LATEST/linux-amd64/datasets' !curl -o dataformat 'https://ftp.ncbi.nlm.nih.gov/pub/datasets/command-line/LATEST/linux-amd64/dataformat' !chmod +x datasets !./datasets --help !./datasets version !./datasets download virus genome taxon SARS-CoV...
github_jupyter
# 2A.algo - L'énigme d'Einstein et sa résolution Résolution de l'énigme [L'énigme d'Einstein](http://fr.wikipedia.org/wiki/%C3%89nigme_d'Einstein). Implémentatin d'une solution à base de règles. ``` from io import StringIO from pandas import read_csv ``` [L'énigme d'Einstein](http://fr.wikipedia.org/wiki/%C3%89nigme...
github_jupyter
``` import os import math import pandas as pd import numpy as np import seaborn as sns from pandas import datetime from matplotlib import pyplot as plt from sklearn.metrics import mean_squared_error from sklearn.metrics import mean_absolute_error from sklearn.metrics import r2_score ## convert one to multiple series de...
github_jupyter
##### Copyright 2020 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
``` from pymongo import MongoClient import pymatgen import bson import itertools import numpy as np import collections from bson import ObjectId from pymatgen.core.structure import Structure from pymatgen.vis.structure_vtk import EL_COLORS M = MongoClient() distortions = M.ferroelectric_dataset.distortions workflow_dat...
github_jupyter
## Chapter 11.3 ``` import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.layers import Embedding, LSTM, Dense, Bidirectional, Dropout from tensorflow.k...
github_jupyter
<img src="https://avatars.githubusercontent.com/u/74911464?s=200&v=4" alt="OpenEO Platform logo" style="float: left; margin-right: 10px;" /> ## openEO Platform UC6 - Near Real Time Forest Dynamics ### Author michele.claus@eurac.edu ### Date: 2021/09/10 ``` from eo_utils import * ``` ## Connect to openEO ``...
github_jupyter
# Introduction to Deep Learning with PyTorch In this notebook, you'll get introduced to [PyTorch](http://pytorch.org/), a framework for building and training neural networks. PyTorch in a lot of ways behaves like the arrays you love from Numpy. These Numpy arrays, after all, are just tensors. PyTorch takes these tenso...
github_jupyter
# Automated Air-Liquid Interface Cell Culture Analysis Using Deep Optical Flow ## Autogenerated Report: RAINBOW image series analysis results #### Author: Alphons G #### Website: https://github.com/AlphonsGwatimba/Automated-Air-Liquid-Interface-Cell-Culture-Analysis-Using-Deep-Optical-Flow ``` # import required packa...
github_jupyter
``` from skimage import io import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from skimage.transform import pyramid_gaussian from torch.autograd import Variable from math import exp device = torch.device("cuda:0" if torch.cu...
github_jupyter
# Conservation Analysis and Epitope Prediction #### Author: C. Mazzaferro, K. Fisch #### Email: cmazzafe@ucsd.edu #### Date: October 2016 ## Outline of Notebook <a id = "toc"></a> 1. <a href = "#background">Background</a> 2. <a href = "#Cons">High Affinity Binding Prediction </a> * <a href = "#Agg">Data Aggrega...
github_jupyter
# Setup ``` %%capture %pip install poetry %pip install git+https://github.com/oughtinc/ergo.git@f5646b672eb0d60c58e7de850eea5f43a4feaacc %pip install xlrd %load_ext google.colab.data_table %%capture import ergo import numpy as np import pandas as pd import ssl import warnings import requests from datetime import timed...
github_jupyter
``` %matplotlib inline import pymc3 as pm import numpy as np import matplotlib.pyplot as plt import pystan import pystan.chains from collections import OrderedDict import pandas as pd plt.style.use('seaborn-darkgrid') print('Runing on PyMC3 v{}'.format(pm.__version__)) ``` # Effective sample size in PyStan Referenc...
github_jupyter
# Highly Performant TensorFlow Batch Inference on TFRecord Data Using the SageMaker CLI In this notebook, we'll show how to use SageMaker batch transform to get inferences on a large datasets. To do this, we'll use a TensorFlow Serving model to do batch inference on a large dataset of images encoded in TFRecord forma...
github_jupyter
# Read in redrock output for SV1 Blanc Deep Exposures ``` !pip install git+https://github.com/desi-bgs/bgs-cmxsv.git --upgrade --user import numpy as np import matplotlib.pyplot as plt from bgs_sv import sv1 # get TileIDs of Blanc deep exposures deep_exp = sv1.blanc_deep_exposures() deep_exp # get redrock zbest file ...
github_jupyter
``` # !wget https://github.com/gouthamcm/recruit/raw/master/Entity%20Recognition%20in%20Resumes.tsv # import pandas as pd # df = pd.read_csv('/content/Entity Recognition in Resumes.tsv', sep='\t') # df.head() # from tqdm.notebook import tqdm # ids = [] # for i, text in tqdm(enumerate(df.Abhishek)): # if not str(...
github_jupyter
# Auxiliary layers - DEV Here we create * a raster that is empty - is this useful ? * a raster with the distance to the raster border - used for selecting pixels in a multi-tile project * a raster with the distance to the polygon border - useful for selecting clean training samples **TODO**: Create a Snakemake task...
github_jupyter
**[Data Visualization: From Non-Coder to Coder Micro-Course Home Page](https://www.kaggle.com/learn/data-visualization-from-non-coder-to-coder)** --- Now it's time for you to demonstrate your new skills with a project of your own! In this exercise, you will work with a dataset of your choosing. Once you've selected...
github_jupyter
# Weighted Least Squares ``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np import statsmodels.api as sm from scipy import stats from statsmodels.iolib.table import SimpleTable, default_txt_fmt np.random.seed(1024) ``` ## WLS Estimation ### Artificial data: Heteroscedasticity 2 groups Model...
github_jupyter
# **Introduction to Competitive Programming** --- Date and Time: 8th July 2019 Monday 5-7pm Venue: Matthews Bldg RM232 Handlers: Payton Yao (Canva), Kathrina Ondap (Google) Coordinator: Luke Sy Repository: https://github.com/ieeeunswsb/cpworkshop ``` print("Welcome to IEEE UNSW student branch's introduction to c...
github_jupyter
# Elaborate statistics features for Silvereye ## Dependencies imports ``` import xarray as xr import os import sys import pandas as pd from functools import wraps import numpy as np import matplotlib.pyplot as plt import seaborn as sns # noqa, pandas aware plotting library from datetime import date from dateutil.re...
github_jupyter
# Convolutional Layer In this notebook, we visualize four filtered outputs (a.k.a. activation maps) of a convolutional layer. In this example, *we* are defining four filters that are applied to an input image by initializing the **weights** of a convolutional layer, but a trained CNN will learn the values of these w...
github_jupyter
``` import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler from sklearn.decomposition import PCA from sklearn.model_selection import train_test_split from sklearn.datasets import fetch_openml import matplotlib.pyplot as plt import time import warnings warnings.filterwarnings('ignore') `...
github_jupyter
## NLP model creation and training ``` from fastai.gen_doc.nbdoc import * from fastai.text import * ``` The main thing here is [`RNNLearner`](/text.learner.html#RNNLearner). There are also some utility functions to help create and update text models. ## Quickly get a learner ``` show_doc(language_model_learner) ```...
github_jupyter
# Exchanging assignment files manually After an assignment has been created using `nbgrader generate_assignment`, the instructor must actually release that assignment to students. This page describes how to do that using your institution's existing learning management system, assuming that the students will fetch the ...
github_jupyter
# Unit 5 - Financial Planning ``` # Initial imports import os import requests import pandas as pd from dotenv import load_dotenv import alpaca_trade_api as tradeapi from MCForecastTools import MCSimulation import json %matplotlib inline # Load .env enviroment variables load_dotenv() ``` ## Part 1 - Personal Finance ...
github_jupyter
# Example of optimizing a convex function # Goal is to test the objective values found by Mango - Search space size: Uniform - Number of iterations to try: 40 - domain size: 5000 - Initial Random: 5 # Benchmarking test with different iterations for serial executions ``` from mango.tuner import Tuner from scipy.stat...
github_jupyter
<img src="../../../images/qiskit-heading.gif" alt="Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook" width="500 px" align="left"> # _*Qiskit Chemistry, Programmatic Approach*_ The latest version of this notebook is available on https://github.com/Qiskit/qiskit...
github_jupyter