code
stringlengths
2.5k
150k
kind
stringclasses
1 value
# 5. Putting it all together **Bring together all of the skills you acquired in the previous chapters to work on a real-life project. From connecting to a database and populating it, to reading and querying it.** It's time to put all your effort so far to good use on a census case study. ### Census case study The cas...
github_jupyter
# Prepare environment ``` !pip install git+https://github.com/katarinagresova/ensembl_scraper.git@6d3bba8e6be7f5ead58a3bbaed6a4e8cd35e62fd ``` # Create config file ``` import yaml config = { "root_dir": "../../datasets/", "organisms": { "homo_sapiens": { "regulatory_feature" } ...
github_jupyter
# Source detection with Gammapy ## Context The first task in a source catalogue production is to identify significant excesses in the data that can be associated to unknown sources and provide a preliminary parametrization in term of position, extent, and flux. In this notebook we will use Fermi-LAT data to illustrat...
github_jupyter
# Quasi-Laplace approximation for Poisson data - toc: true - badges: true - comments: true - categories: [jupyter] ### About The [quasi-Laplace approximation]({% post_url 2020-06-22-intuition-for-quasi-Laplace %}) may be extended to approximate the posterior of a Poisson distribution with a Gaussian, as we will see...
github_jupyter
``` import nltk import pandas as pd import numpy as np import matplotlib.pyplot as plt from nltk.stem import WordNetLemmatizer from nltk.corpus import wordnet import re, collections from collections import defaultdict from sklearn.feature_extraction.text import CountVectorizer from sklearn.metrics import mean_squared_e...
github_jupyter
# Hello Segmentation A very basic introduction to using segmentation models with OpenVINO. We use the pre-trained [road-segmentation-adas-0001](https://docs.openvinotoolkit.org/latest/omz_models_model_road_segmentation_adas_0001.html) model from the [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/)...
github_jupyter
# TD - Implémentation des arbres en POO On va dans ce TD créer une classe arbre binaire qui va nous permettre d'implémenter cette structure de données avec toutes ses caractéristiques. On se souvient du cours sur les arbres https://pixees.fr/informatiquelycee/n_site/nsi_term_structDo_arbre.html dans lequel on définit...
github_jupyter
``` from __future__ import print_function import math from IPython import display from matplotlib import cm from matplotlib import gridspec from matplotlib import pyplot as plt import numpy as np import pandas as pd from sklearn import metrics import tensorflow as tf from tensorflow.python.data import Dataset tf.log...
github_jupyter
# Linear_Reg Author ~ Saurabh Kumar Date ~ 05-Dec-21 ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import warnings warnings.filterwarnings("ignore") #simple_linera_regression class Simple_linear_regression: def __init__(self,learning_rate=1e-3,n_steps=100...
github_jupyter
# Collaboration and Competition --- In this notebook, you will learn how to use the Unity ML-Agents environment for the third project of the [Deep Reinforcement Learning Nanodegree](https://www.udacity.com/course/deep-reinforcement-learning-nanodegree--nd893) program. ### 1. Start the Environment We begin by import...
github_jupyter
<i>Copyright (c) Microsoft Corporation. All rights reserved.</i> <i>Licensed under the MIT License.</i> # Testing different Hyperparameters and Benchmarking In this notebook, we will cover how to test different hyperparameters for a particular dataset and how to benchmark different parameters across a group of datas...
github_jupyter
``` import os import torch from torch.utils.data import DataLoader, Dataset from torchvision.transforms import ToTensor, ToPILImage from torchvision.models.detection import fasterrcnn_resnet50_fpn from torchvision.models.detection.faster_rcnn import FastRCNNPredictor from PIL import Image class PlayerDataset(Dataset): ...
github_jupyter
``` !git clone https://github.com/GraphGrailAi/ruGPT3-ZhirV cd ruGPT3-ZhirV cd .. !pip3 install -r requirements.txt ``` Обучение эссе !python pretrain_transformers.py \ --output_dir=/home/jovyan/ruGPT3-ZhirV/ \ --overwrite_output_dir \ --model_type=gpt2 \ --model_name_or_path=sberbank-ai/rugpt3large_b...
github_jupyter
``` # Copyright 2022 Google LLC. # 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 agreed to in writing, s...
github_jupyter
``` import torch import torch.nn as nn import onmt import onmt.inputters import onmt.modules import onmt.utils ``` We begin by loading in the vocabulary for the model of interest. This will let us check vocab size and to get the special ids for padding. ``` vocab = dict(torch.load("../../data/data.vocab.pt")) src_pa...
github_jupyter
# 决策树 - 非参数学习算法 - 天然解决多分类问题 - 也可以解决回归问题 - 非常好的可解释性 ``` import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import cross_val_score from sklearn import datasets iris = datasets.load_iris() print(iris.DESCR) X = iris.data[:, 2:] # 取后两个特征 y = iris.target plt.scatter(X[y==0, 0], X[y==0, 1]) pl...
github_jupyter
``` import pandas as pd import numpy as np from PIL import Image import os import sys !pip install ipython-autotime %load_ext autotime %matplotlib inline ``` 1. Extract your dataset and split into train_x, train_y, test_x and test_y. 2. Execute the following cells --- ## Hybrid Social Group Optimization ---...
github_jupyter
# Final Project For the final project, you will need to implement a "new" statistical algorithm in Python from the research literature and write a "paper" describing the algorithm. Suggested papers can be found in Sakai:Resources:Final_Project_Papers ## Paper The paper should have the following: ### Title Shoul...
github_jupyter
# ClusterFinder Reference genomes reconstruction This notebook validates the 10 genomes we obtained from NCBI based on the ClusterFinder supplementary table. We check that the gene locations from the supplementary table match locations in the GenBank files. ``` from Bio import SeqIO from Bio.SeqFeature import Featu...
github_jupyter
# Realization of Recursive Filters *This jupyter notebook is part of a [collection of notebooks](../index.ipynb) on various topics of Digital Signal Processing. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sascha.Spors@uni-rostock.de).* ## Cascaded Structures The realization of rec...
github_jupyter
# Utilizing daal4py in Data Science Workflows The notebook below has been made to demonstrate daal4py in a data science context. It utilizes a Cycling Dataset for pyworkout-toolkit, and attempts to create a linear regression model from the 5 features collected for telemetry to predict the user's Power output in the a...
github_jupyter
# **JIVE: Joint and Individual Variation Explained** JIVE (Joint and Individual Variation Explained) is a dimensional reduction algorithm that can be used when there are multiple data matrices (data blocks). The multiple data block setting means there are $K$ different data matrices, with the same number of observatio...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import pandas as pd import check_lab05 as p plt.rcParams.update({'font.size': 14}) plt.rcParams['lines.linewidth'] = 3 pi=np.pi ``` ME 3264 - Applied Measurements Laboratory =========================================== Lab #5 - Linear Variable Differential Trans...
github_jupyter
``` import tensorflow as tf from tensorflow.keras import layers, Model from tensorflow.keras.activations import relu from tensorflow.keras.models import Sequential, load_model from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping from tensorflow.keras.losses import BinaryCrossentropy from tensorflow.ker...
github_jupyter
# 网络参数的初始化 [![](https://gitee.com/mindspore/docs/raw/master/resource/_static/logo_source.png)](https://gitee.com/mindspore/docs/blob/master/docs/mindspore/programming_guide/source_zh_cn/initializer.ipynb)&emsp;[![](https://gitee.com/mindspore/docs/raw/master/resource/_static/logo_notebook.png)](https://obs.dualstack.c...
github_jupyter
``` import numpy as np import pandas as pd # load the contents of a file into a pandas Dataframe input_file = '/Users/aurelianosancho/Google Drive/Pre_Processing/train.csv' df_titanic = pd.read_csv(input_file) ``` $\textbf{NOTE}$ Although it is not demonstrated in this section, you must ensure that any feature engin...
github_jupyter
# The BioBB REST API The **[BioBB REST API](https://mmb.irbbarcelona.org/biobb-api)** allows the execution of the **[BioExcel Building Blocks](https://mmb.irbbarcelona.org/biobb/)** in a remote server. ## Documentation For an extense documentation section, please go to the **[BioBB REST API website help](https://mmb...
github_jupyter
An illustration of the metric and non-metric MDS on generated noisy data. The reconstructed points using the metric MDS and non metric MDS are slightly shifted to avoid overlapping. #### New to Plotly? Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloadi...
github_jupyter
# Web Coverage Service (WCS) Download Example ## Introduction We'll demonstrate how to download a GeoTIFF data file from a public WCS service using Python 3. ### WCS Data Service For this demonstration we'll use Landfire (LF_1.4.0): https://www.landfire.gov/data_access.php For Landfire LF_1.4.0 we see that the base U...
github_jupyter
# Python datetime module We will look at an important standard library, the [datetime library][1] which contains many powerful functions to support date, time and datetime manipulation. Pandas does not rely on this object and instead creates its own, a `Timestamp`, discussed in other notebooks. The datetime library i...
github_jupyter
``` import numpy as np import pandas as pd import time import os from pyspark.ml.clustering import KMeans from pyspark.ml.evaluation import ClusteringEvaluator from pyspark.ml.linalg import Vectors from matplotlib import pyplot as plt from pyspark.sql import SparkSession # from pyspark.ml.clustering import KMeans, K...
github_jupyter
# VacationPy ---- #### Note * Keep an eye on your API usage. Use https://developers.google.com/maps/reporting/gmp-reporting as reference for how to monitor your usage and billing. * Instructions have been included for each segment. You do not have to follow them exactly, but they are included to help you think throug...
github_jupyter
# Hybrid Recommendations with the Movie Lens Dataset __Note:__ It is recommended that you complete the companion __als_bqml.ipynb__ notebook before continuing with this __als_bqml_hybrid.ipynb__ notebook. This is, however, not a requirement for this lab as you have the option to bring over the dataset + trained model....
github_jupyter
# Introduction to XGBoost-Spark Cross Validation with GPU The goal of this notebook is to show you how to levarage GPU to accelerate XGBoost spark cross validatoin for hyperparameter tuning. The best model for the given hyperparameters will be returned. Here takes the application 'Mortgage' as an example. A few libr...
github_jupyter
<a href="https://colab.research.google.com/github/ryanlandvater/qIS/blob/main/QuantImmunoSubtraction.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Quantitative Immuno-Subtraction Project --- ``` # %matplotlib notebook import sys ...
github_jupyter
<div> <h1 style="margin-top: 50px; font-size: 33px; text-align: center"> Homework 5 - Visit the Wikipedia hyperlinks graph! </h1> <br> <div style="font-weight:200; font-size: 20px; padding-bottom: 15px; width: 100%; text-align: center;"> <right>Maria Luisa Croci, Livia Lilli, Pavan Kumar Alikana</ri...
github_jupyter
# Multi-wavelength maps New in version `0.2.1` is the ability for users to instantiate wavelength-dependent maps. Nearly all of the computational overhead in `starry` comes from computing rotation matrices and integrals of the Green's basis functions, which makes it **really** fast to compute light curves at different ...
github_jupyter
## Machine Learning- Exoplanet Exploration #### Extensive Data Dictionary: https://exoplanetarchive.ipac.caltech.edu/docs/API_kepcandidate_columns.html Highlightable columns of note are: * kepoi_name: A KOI is a target identified by the Kepler Project that displays at least one transit-like sequence within Kepler ti...
github_jupyter
``` path = "D:\\School\\Bank_uppg_mockdata.txt" class DataSource: def datasource_conn(): text_file = open(path) if(text_file.readable): text_file.close() return [True, "Connection successful"] text_file.close() return[False, "Connection unsuccessful"] ...
github_jupyter
# Fingerprint Generators ## Creating and using a fingerprint generator Fingerprint generators can be created by using the functions that return the type of generator desired. ``` from rdkit import Chem from rdkit.Chem import rdFingerprintGenerator mol = Chem.MolFromSmiles('CC(O)C(O)(O)C') generator = rdFingerprintG...
github_jupyter
# Part 3: Launch a Grid Network Locally In this tutorial, you'll learn how to deploy a grid network into a local machine and then interact with it using PySyft. _WARNING: Grid nodes publish datasets online and are for EXPERIMENTAL use only. Deploy nodes at your own risk. Do not use OpenGrid with any data/models you w...
github_jupyter
``` # import sys # sys.path.append('https://github.com/alphaBenj/RoughCut/blob/master/files/data_iex.py') %matplotlib inline import matplotlib.pyplot as plt from matplotlib import colors import data_iex as IEX dir(IEX) # ?filter=symbol,volume,lastSalePrice iex = IEX.API() dir(iex) iex.lastTrade(['AAPL', 'IBM', "FLR"])...
github_jupyter
#### Reactions processing with AQME - substrates + TS ``` # cell with import, system name and PATHs import os, glob, subprocess import shutil from pathlib import Path from aqme.csearch import csearch from aqme.qprep import qprep from aqme.qcorr import qcorr from rdkit import Chem import pandas as pd ``` ###### Step 1...
github_jupyter
# Import all the necessary libraries ``` import cv2, time, pandas from datetime import datetime ``` # Initialize the variables ``` first = None # This variable holds the value of the first frame status_list = [None,None] # This variable holds the list of statuses - if Python has come across a frame greater than 1000...
github_jupyter
``` import sys sys.path.append('../../code/') import os import json from datetime import datetime import time from math import * import numpy as np import pandas as pd import matplotlib.pyplot as plt import scipy.stats as stats import igraph as ig import networkx as nx from load_data import load_citation_network, c...
github_jupyter
## Download and extract zip from web - Specifies the source link, destination url and file name to download and extract data files - Currently reading from external folder as github does not support large files - To rerun function for testing before submission - To add checks and conditions for the function - ...
github_jupyter
``` %matplotlib inline ``` # Linear classifier on sensor data with plot patterns and filters Here decoding, a.k.a MVPA or supervised machine learning, is applied to M/EEG data in sensor space. Fit a linear classifier with the LinearModel object providing topographical patterns which are more neurophysiologically in...
github_jupyter
``` import numpy as np from bokeh.plotting import figure, output_file, show from bokeh.io import output_notebook from nsopy import SGMDoubleSimpleAveraging as DSA from nsopy.loggers import EnhancedDualMethodLogger output_notebook() %cd .. from smpspy.oracles import TwoStage_SMPS_InnerProblem ``` # Solving dual mod...
github_jupyter
# Энтропия и критерий Джини $p_i$ - вероятность нахождения системы в i-ом состоянии. Энтропия Шеннона определяется для системы с N возможными состояниями следующим образом $S = - \sum_{i=1}^Np_ilog_2p_i$ Критерий Джини (Gini Impurity). Максимизацию этого критерия можно интерпретировать как максимизацию числа пар ...
github_jupyter
``` import numpy as np import keras from keras.datasets import imdb from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.preprocessing.text import Tokenizer import matplotlib.pyplot as plt %matplotlib inline np.random.seed(42) ``` ## Loading the data The dataset comes pr...
github_jupyter
# Interpolation ### [Gerard Gorman](http://www.imperial.ac.uk/people/g.gorman), [Matthew Piggott](http://www.imperial.ac.uk/people/m.d.piggott), [Christian Jacobs](http://www.christianjacobs.uk) ## Interpolation vs curve-fitting Consider a discrete set of data points $$ (x_i, y_i),\quad i=0,\ldots,N,$$ and that w...
github_jupyter
## Imperfect Tests and The Effects of False Positives The US government has been widely criticized for its failure to test as many of its citizens for COVID-19 infections as other countries. But is mass testing really as easy as it seems? This analysis of the false positive and false negative rates of tests, using pub...
github_jupyter
<h1>Model Deployment</h1> Once we have built and trained our models for feature engineering (using Amazon SageMaker Processing and SKLearn) and binary classification (using the XGBoost open-source container for Amazon SageMaker), we can choose to deploy them in a pipeline on Amazon SageMaker Hosting, by creating an In...
github_jupyter
## Preprocessing ``` # Import our dependencies from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler import pandas as pd import tensorflow as tf from keras.callbacks import ModelCheckpoint # Import and read the charity_data.csv. import pandas as pd application_df = p...
github_jupyter
Goal of this notebook to test several classifiers on the data set with different features And beforehand i want to thank Jose Portilla for his magnificent "Python for Data Science and Machine Learning" course on Udemy , which helped me to dive into ML =) ### Let's begin First of all neccesary imports ``` import num...
github_jupyter
# SimFin Test All Datasets This Notebook performs automated testing of all the bulk datasets from SimFin. The datasets are first downloaded from the SimFin server and then various tests are performed on the data. An exception is raised if any problems are found. This Notebook can be run as usual if you have `simfin` ...
github_jupyter
``` # coding=utf-8 from __future__ import absolute_import, division, print_function, unicode_literals import argparse import logging import os from pathlib import Path import random from io import open import pickle import math import numpy as np import requests logging.basicConfig(format='%(asctime)s - %(levelname...
github_jupyter
### Importing required stuff ``` import time import math import random import pandas as pd import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from datetime import timedelta import scipy.misc import glob import sys %matplotlib inline ``` ### Helper files to load data ``` # Helper functions...
github_jupyter
# Evaluation von Parsingtechniken Das Parsing von Textdateien ist ein wichtiger Mechanismus, welcher wärend Informationsbearbeitung einen hohen Stellenwert innehält. In order to be able to choose an adequate technique to be able to parse our custom DSL, we need to evaluate multiple of these techniques first. *The f...
github_jupyter
## Use the *Machine Learning Workflow* to process & transform Pima Indian data to create a prediction model. ### This model must predict which people are likely to develop diabetes with 70% accuracy! ##Import Libraries ``` import pandas as pd import matplotlib.pyplot as plt import numpy as np #plot inline instead of...
github_jupyter
![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/streamlit_notebooks/healthcare/NER_LEGAL_DE.ipynb) # **Detect legal entitie...
github_jupyter
``` import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import Dataset, DataLoader from torch.utils.tensorboard import SummaryWriter torch.manual_seed(42) class RNNRegressor(nn.Module): def __init__(self, input_dim, hidden_dim, output_dim): s...
github_jupyter
## Data Wrangling with Python: Intro to Pandas Note: Notebook adapted from [here](https://github.com/EricElmoznino/lighthouse_pandas_tutorial/blob/master/pandas_tutorial.ipynb) & [here](https://github.com/sedv8808/LighthouseLabs/tree/main/W02D2) & from LHL's [21 Day Data Challenge](https://data-challenge.lighthouselabs...
github_jupyter
# Mask R-CNN Demo A quick intro to using the pre-trained model to detect and segment objects. ``` import os import sys import random import math import numpy as np import skimage.io import matplotlib import matplotlib.pyplot as plt # Root directory of the project ROOT_DIR = os.path.abspath("../") # Import Mask RCNN...
github_jupyter
# Creating a Sentiment Analysis Web App ## Using PyTorch and SageMaker _Deep Learning Nanodegree Program | Deployment_ --- Now that we have a basic understanding of how SageMaker works we will try to use it to construct a complete project from end to end. Our goal will be to have a simple web page which a user can u...
github_jupyter
# **Tansfer Learning for Classification of Horses and Humans** ## **Abstract** Aim of the notebook is to demonstrate the use of the transfer learning for improving the model accuracy for real-world images. ``` import os import tensorflow as tf from tensorflow.keras import layers from tensorflow.keras import Model fr...
github_jupyter
Let's design a LNA using Infineon's BFU520 transistor. First we need to import scikit-rf and a bunch of other utilities: ``` import numpy as np import skrf from skrf.media import DistributedCircuit import skrf.frequency as freq import skrf.network as net import skrf.util import matplotlib.pyplot as plt %matplotlib...
github_jupyter
# Model Selection ![Data Science Workflow](img/ds-workflow.png) ## Model Selection - The process of selecting the model among a collection of candidates machine learning models ### Problem type - What kind of problem are you looking into? - **Classification**: *Predict labels on data with predefined classes* ...
github_jupyter
``` import numpy as np arr = np.load('MAPS.npy') print(arr) print(np.shape(arr)) arr2 = np.empty((20426, 88), dtype = int) for i in range(arr.shape[0]): for j in range(arr.shape[1]): if arr[i,j]==False: arr2[i,j]=int(0) int(arr2[i,j]) elif arr[i,j]==True: arr2[i,...
github_jupyter
``` # Necessary imports import warnings warnings.filterwarnings('ignore') import re import os import numpy as np import scipy as sp from scipy.sparse import csr_matrix from sklearn import datasets from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer fr...
github_jupyter
# Running Plato in Google's Colab Notebooks ## 1. Preparation ### Use Chrome broswer Since Colab is a product from Google, to take the most advantage of it, Chrome is the most recommended broswer here. ### Activating GPU support If you need GPU support in your project, you may activate it in Google Colab by clicki...
github_jupyter
# Tutorial 1: Instatiating a *scenario category* In this tutorial, we will cover the following items: 1. Create *actor categories*, *activity categories*, and *physical thing categories* 2. Instantiate a *scenario category* 3. Show all tags of the *scenario category* 4. Use the `includes` function of a *scenario cate...
github_jupyter
#### New to Plotly? Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloading the client and [reading the primer](https://plot.ly/python/getting-started/). <br>You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-fo...
github_jupyter
# Python course Day 4 ## Dictionaries ``` student = {"number": 570, "name":"Simon", "age":23, "height":165} print(student) print(student['name']) print(student['age']) my_list = {1: 23, 2:56, 3:78, 4:14, 5:67} my_list[1] my_list.keys() my_list.values() student.keys() student.values() student['number'] = 111 print(stu...
github_jupyter
``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import nltk %matplotlib inline nltk.download_shell() messages = [line.rstrip() for line in open('SMSSpamCollection')] ## Put in your dataset here len(messages) messages[50] for msg_no, message in enumerate(messages[:10]): ...
github_jupyter
# Using Hyperopt to optimize XGB model hyperparameters ## Importing the libraries and loading the data ``` #!pip install --upgrade tables #!pip install eli5 #!pip install xgboost #!pip install hyperopt import numpy as np import pandas as pd import xgboost as xgb from sklearn.metrics import mean_absolute_error as ma...
github_jupyter
## Statistical Analysis We have learned null hypothesis, and compared two-sample test to check whether two samples are the same or not To add more to statistical analysis, the follwoing topics should be covered: 1- Approxite the histogram of data with combination of Gaussian (Normal) distribution functions: Gau...
github_jupyter
``` #default_exp data.transforms #export from fastai2.torch_basics import * from fastai2.data.core import * from fastai2.data.load import * from fastai2.data.external import * from sklearn.model_selection import train_test_split from nbdev.showdoc import * ``` # Helper functions for processing data and basic transfor...
github_jupyter
``` import numpy as np import pandas as pd import torch import torchvision from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from matplotlib import pyplot as plt %matplotlib inline class MosaicDa...
github_jupyter
# TV Script Generation In this project, you'll generate your own [Simpsons](https://en.wikipedia.org/wiki/The_Simpsons) TV scripts using RNNs. You'll be using part of the [Simpsons dataset](https://www.kaggle.com/wcukierski/the-simpsons-by-the-data) of scripts from 27 seasons. The Neural Network you'll build will gen...
github_jupyter
# Parsing Inputs In the chapter on [Grammars](Grammars.ipynb), we discussed how grammars can be used to represent various languages. We also saw how grammars can be used to generate strings of the corresponding language. Grammars can also perform the reverse. That is, given a string, one can decompose the string into ...
github_jupyter
<a href="http://landlab.github.io"><img style="float: left" src="../../landlab_header.png"></a> # Using plotting tools associated with the Landlab NetworkSedimentTransporter component <hr> <small>For more Landlab tutorials, click here: <a href="https://landlab.readthedocs.io/en/latest/user_guide/tutorials.html">http...
github_jupyter
The tanh-sinh (or double exponential) method. We calculate an integral in the following fashion: $$ I=\int_{-1}^{1} dx f(x) = \int_{-\infty}^{\infty} dt \; f(g(t)) \;g^{\prime}(t) \approx h \sum_{j=-N}^{N} w_j \; f(x_j)\; , $$ with $x_j= g(h \, t)$ and $w_j = g^{\prime}(h \, t) $. The functio $g(t)$ transorms the...
github_jupyter
``` # Autoreload packages in case they change. %load_ext autoreload %autoreload 2 %matplotlib inline import matplotlib.pyplot as plt import numpy as np import os import sys import btk import galsim import warnings ``` # "Custom" tutorial This tutorial is intended to showcase how to customize some elements of BTK, nam...
github_jupyter
- Scipy의 stats 서브 패키지에 있는 binom 클래스는 이항 분포 클래스이다. n 인수와 p 인수를 사용하여 모수를 설정한다 ``` N = 10 theta = 0.6 rv = sp.stats.binom(N, theta) rv ``` - pmf 메서드를 사용하면, 확률 질량 함수 (pmf: probability mass function)를 계산할 수 있다. ``` %matplotlib inline xx = np.arange(N + 1) plt.bar(xx, rv.pmf(xx), align='center') plt.ylabel('p(x)') plt.tit...
github_jupyter
<table style="float:left; border:none"> <tr style="border:none; background-color: #ffffff"> <td style="border:none"> <a href="http://bokeh.pydata.org/"> <img src="assets/bokeh-transparent.png" style="width:50px" > </a> ...
github_jupyter
``` import pandas as pd import numpy as np import pickle as pk file_name = '1_min' df = pd.read_csv(file_name + '.csv') df['behavior'] = np.zeros(len(df)).astype(np.int) intention_2_action_delay = 3000 acc_threshold = 1 # 0 for changing to left # 1 for changing to right # 2 for following next_lane_change_time = dict...
github_jupyter
``` from os.path import exists import openpyxl import os import pandas as pd import re from collections import Counter import streamlit as st pd.set_option('display.max_colwidth',None) result = 'searchoutput.csv' if exists(result): os.remove(result) # 创建结果文件 wbResult = openpyxl.Workbook() wsResult = wbResult....
github_jupyter
## Gaussian processes with genetic algorithm for the reconstruction of late-time Hubble data This notebook uses Gaussian processes (GP) with the genetic algorithm (GA) to reconstruct the cosmic chronometers and supernovae data sets ([2106.08688](https://arxiv.org/abs/2106.08688)). We shall construct our own GP class a...
github_jupyter
[![pythonista.io](imagenes/pythonista.png)](https://www.pythonista.io) # Declaraciones y bloques de código. ## Flujo de ejecución del código. El intérprete de Python es capaz de leer, evaluar y ejecutar una sucesión de instrucciones línea por línea de principio a fin. A esto se le conoce copmo flujo de ejecución de...
github_jupyter
### Testing accuracy of RF classifier for lightly loaded, testing and training with all the rotational speeds ``` from jupyterthemes import get_themes import jupyterthemes as jt from jupyterthemes.stylefx import set_nb_theme set_nb_theme('chesterish') import pandas as pd data_10=pd.read_csv(r'D:\Acads\BTP\Lightly Loa...
github_jupyter
<div align="center"> <h1><img width="30" src="https://madewithml.com/static/images/rounded_logo.png">&nbsp;<a href="https://madewithml.com/">Made With ML</a></h1> Applied ML · MLOps · Production <br> Join 20K+ developers in learning how to responsibly <a href="https://madewithml.com/about/">deliver value</a> with ML. ...
github_jupyter
# AWS. S3 Buckets > 'Working with AWS S3 buckets' - toc:true - branch: master - badges: false - comments: false - author: Alexandros Giavaras - categories: [aws, s3-buckets, cloud-computing, data-storage, data-engineering, data-storage, boto3] ## Overview In this notebook, we are going to have a brief view on AWS ...
github_jupyter
``` %matplotlib inline ``` # Demo Axes Grid Grid of 2x2 images with single or own colorbar. ``` import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import ImageGrid plt.rcParams["mpl_toolkits.legacy_colorbar"] = False def get_demo_image(): import numpy as np from matplotlib.cbook import get_sa...
github_jupyter
#Importo librerie ``` import pandas as pd import numpy as np import concurrent.futures import time from requests.exceptions import ReadTimeout !pip install -U -q PyDrive from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from google.colab import auth from oauth2client.client import GoogleCredent...
github_jupyter
# Notebook use to check the result of the classifier, how well can you detect the nucleus . You can click `shift` + `enter` to run one cell, you can also click run in top menu. To run all the cells, you can click `kernel` and `Restart and run all` in the top menu. ``` # Some more magic so that the notebook will reloa...
github_jupyter
### Generator States Let's look at a simple generator function: ``` def gen(s): for c in s: yield c ``` We create an generator object by calling the generator function: ``` g = gen('abc') ``` At this point the generator object is **created**, but we have not actually started running it. To do so, we ca...
github_jupyter
``` import tkinter as tk from tkinter import filedialog from tkinter import * from PIL import ImageTk, Image # Load your model model = load_model('Saved_model.h5') # Path to your model # Initialise GUI top=tk.Tk() # Window dimensions (800x600) top.geometry('800x600') # Window title top.title('Traffic sign classifica...
github_jupyter
# Notebook 2: Setup Domain <img src="img/tab_start.png" alt="tab" style="width: 100px; margin:0;" /> Now that we have sshed into our virtual machine (as described in the 👈🏿 notebook [01-data-owners-login.ipynb](01-data-owners-login.ipynb)), let's move on to provision our Domain node. **Note:** These steps are desi...
github_jupyter
# Importing libraries ``` import pandas as pd import random import numpy as np from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.utils import to_categorical from tensorflow.keras import regularizers import matplotlib.pyplot...
github_jupyter