code
stringlengths
2.5k
150k
kind
stringclasses
1 value
``` import os os.chdir(os.getcwd() + '/Models/') from leia import SentimentIntensityAnalyzer from textblob import TextBlob from textblob.classifiers import NaiveBayesClassifier import spacy import re ``` ## LeIA ``` analyzer = SentimentIntensityAnalyzer() def leia(text): text = str(text) result = analyzer.pol...
github_jupyter
The purpose of this notebook is to provide some examples for how to use the visibility difference plotting tools `plot_diff_waterfall` and `plot_diff_uv`. These tools accept a pair of `UVData` objects—along with some extra parameters—and visualize the difference between the data (or a subset thereof) stored...
github_jupyter
# Vega, Ibis, and OmniSci Performance In this notebook we will show two charts. The first generally works, albeit is a bit slow. The second is basically inoperable because of performance issues. I believe these performance issues are primarily due to two limitations in Vega currently: 1. Each transform in the datafl...
github_jupyter
## Simulation for biallelic dynamics of SCN1A ``` # The following section only needs to be executed when running off of google drive # from google.colab import drive # drive.mount('/content/drive') # This needs to be run only once at the beginning to access the models #-----------------------------------------------...
github_jupyter
``` # default_exp learner #export from fastai.data.all import * from fastai.optimizer import * from fastai.callback.core import * #hide from nbdev.showdoc import * #export _all_ = ['CancelFitException', 'CancelEpochException', 'CancelTrainException', 'CancelValidException', 'CancelBatchException'] #export _loop = ['Sta...
github_jupyter
##### Copyright 2018 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
## 人脸与人脸关键点检测 在训练用于检测面部关键点的神经网络之后,你可以将此网络应用于包含人脸的*任何一个*图像。该神经网络需要一定大小的Tensor作为输入,因此,要检测任何一个人脸,你都首先必须进行一些预处理。 1. 使用人脸检测器检测图像中的所有人脸。在这个notebook中,我们将使用Haar级联检测器。 2. 对这些人脸图像进行预处理,使其成为灰度图像,并转换为你期望的输入尺寸的张量。这个步骤与你在Notebook 2中创建和应用的`data_transform` 类似,其作用是重新缩放、归一化,并将所有图像转换为Tensor,作为CNN的输入。 3. 使用已被训练的模型检测图像上的人脸关键点。 --- 在下一个...
github_jupyter
<a href="https://colab.research.google.com/github/absbin/AGCWD/blob/master/Deep_Features2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` %reload_ext autoreload %autoreload 2 %matplotlib inline import math from tqdm import tqdm import os impo...
github_jupyter
# Symmetries: Honeycomb Heisenberg model The goal of this tutorial is to learn about group convolutional neural networks (G-CNNs), a useful tool for simulating lattices with high symmetry. The G-CNN is a generalization to the convolutional neural network (CNN) to non-abelian symmetry groups (groups that contain at le...
github_jupyter
``` from nuisancelib import * %matplotlib inline ``` # Merge dataframes containing real MRI data and segmentation statistics ``` real_files = pd.read_csv('../output/real_output.csv') real_df = pd.DataFrame(real_files,columns=['Date', 'sid', 'ses', 'snr_total', 'TxRefAmp', 'AcquisitionTime', 'SAR', ...
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
# Cross-Validation Cross-validation is a step where we take our training sample and further divide it in many folds, as in the illustration here: ```{image} ./img/feature_5_fold_cv.jpg :alt: 5-fold :width: 400px :align: center ``` As we talked about in the last chapter, cross-validation allows us to test our models ...
github_jupyter
``` import random import pennylane as qml from pennylane import numpy as np from myutils import Datasets from myutils import Preprocessing from myutils import Helpers import os import sys sys.path.insert(0,'..') from maskit.datasets import load_data from matplotlib import pyplot as plt #Magic Command, so changes in my...
github_jupyter
# Part I. ETL Pipeline for Pre-Processing the Files ## RUNNING THE FOLLOWING CODE FOR PRE-PROCESSING THE FILES #### Import Python packages ``` # Import Python packages import pandas as pd import cassandra import re import os import glob import numpy as np import json import csv ``` #### Creating list of filepaths ...
github_jupyter
# Project Euler in R ## Number letter counts If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? **NOTE:** Do n...
github_jupyter
# Module 5: Research Dissemination (30 minutes) From "[Piled Higher and Deeper](http://phdcomics.com/comics/archive.php?comicid=1174)" by Jorge Cham <img src="http://www.phdcomics.com/comics/archive/phd051809s.gif" /> ## Take a moment to read these University policies ### Openness in Research In Section 2.2 of the [...
github_jupyter
## Excel "What if?" analysis with Python - Part 4: Project management and packaging In the first three notebooks, we've developed some Python approaches to typical Excel "what if?" analyses. Along the way we explored some slightly more advanced Python topics (for relative newcomers to Python) such as: * List compreh...
github_jupyter
## Introduction This notebook demostrates the core functionality of pymatgen, including the core objects representing Elements, Species, Lattices, and Structures. By convention, we import pymatgen as mg. ``` import pymatgen as mg ``` ## Basic Element, Specie and Composition objects Pymatgen contains a set of core...
github_jupyter
# Stock Price Prediction From Employee / Job Market Information ## Modelling: Linear Model Objective utilise the Thinknum LinkedIn and Job Postings datasets, along with the Quandl WIKI prices dataset to investigate the effect of hiring practices on stock price. In this notebook I'll begin exploring the increase in pred...
github_jupyter
# Data Aggregation and Group Operations ``` import numpy as np import pandas as pd PREVIOUS_MAX_ROWS = pd.options.display.max_rows pd.options.display.max_rows = 20 np.random.seed(12345) import matplotlib.pyplot as plt plt.rc('figure', figsize=(10, 6)) np.set_printoptions(precision=4, suppress=True) ``` ## GroupBy Mec...
github_jupyter
``` from IPython.core.display import display, HTML display(HTML("<style>.container { width:75% !important; }</style>")) import numpy as np import torch import time from carle.env import CARLE from carle.mcl import CornerBonus, SpeedDetector, PufferDetector, AE2D, RND2D from game_of_carle.agents.harli import HARLI fro...
github_jupyter
# Network Visualization (TensorFlow) In this notebook we will explore the use of *image gradients* for generating new images. When training a model, we define a loss function which measures our current unhappiness with the model's performance; we then use backpropagation to compute the gradient of the loss with respe...
github_jupyter
# LassoRegresion with Scale & Power Transformer This Code template is for the regression analysis using Lasso Regression, the feature transformation technique Power Transformer and rescaling technique Scale in a pipeline. Lasso stands for Least Absolute Shrinkage and Selection Operator is a type of linear regression t...
github_jupyter
``` #http://colah.github.io/posts/2015-08-Understanding-LSTMs/ from collections import Counter import json import nltk from nltk.corpus import stopwords WORD_FREQUENCY_FILE_FULL_PATH = "analysis.vocab" class MyVocabulary: def __init__(self, vocabulary, wordFrequencyFilePath): self.vocabulary = vocabul...
github_jupyter
##### Copyright 2018 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
``` import torch from torch import nn import torchvision from torchvision import datasets, transforms ``` # Load data ``` batch_size = 32 train_transforms = transforms.Compose([transforms.ToTensor(), transforms.Normalize([0.131],[0.308])]) test_transforms = transforms.Compose([transfo...
github_jupyter
# Le Bloc Note pour ajouter du style Dans un notebook jupyter on peut rédiger des commentaires en langage naturel, intégrer des liens hypertextes, des images et des vidéos en langage HTML dans des cellules de type **`Markdown`**. C'est ce que décrit le bloc-note [HTML](HTML-Le_BN_pour_multimedier.ipynb) - Un bloc-not...
github_jupyter
# Applied Deep Learning Final Project ### Author: David Schemitsch (ds3300) Many local governments aim to make data available to the public under the open data movement. However, a significant portion are released as PDFs, which makes it "available" but not in an easily accessible format like a CSV (for example: pr...
github_jupyter
``` %cd ../.. %run cryptolytic/notebooks/init.ipynb import pandas as pd import cryptolytic.util.core as util import cryptolytic.start as start import cryptolytic.viz.plot as plot import cryptolytic.data.sql as sql import cryptolytic.data.historical as h import cryptolytic.model as m from statsmodels.graphics.tsaplots ...
github_jupyter
``` import json import os import sys import warnings import numpy as np import pandas as pd from datetime import datetime from pprint import pprint from sklearn.preprocessing import StandardScaler from sklearn.impute import SimpleImputer as Imputer from sklearn.pipeline import Pipeline from sklearn.model_selection imp...
github_jupyter
# 0. Setup ``` # Imports import arviz as az import io import matplotlib.pyplot as plt import numpy as np import pandas as pd import pymc3 as pm import scipy import scipy.stats as st import theano.tensor as tt # Helper functions def plot_golf_data(data, ax=None): """Utility function to standardize a pretty plotti...
github_jupyter
# RoadMap 16 - Classification 3 - Training & Validating [Custom CNN, Custom Dataset] ``` import torch import torchvision import torchvision.transforms as transforms import torch.optim as optim import matplotlib.pyplot as plt import numpy as np from torchvision import datasets ``` # [NOTE: - The network, transformatio...
github_jupyter
``` %reload_ext autoreload %autoreload 2 import warnings warnings.filterwarnings('ignore') import os.path as op from collections import Counter import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns # from tabulate import tabulate from rdkit.Chem import AllChem as Chem from rdki...
github_jupyter
``` import numpy as np import pandas as pd import os from datetime import datetime, timedelta import matplotlib.pyplot as plt %matplotlib inline np.random.seed(42) ``` # Portfolio Planner In this activity, you will use the iexfinance api to grab historical data for a 60/40 portfolio using `SPY` to represent the stock...
github_jupyter
# Weekend Movie Trip Dalton Hahn (2762306) ## MovieLens Datasets MovieLens Latest-Small Dataset http://files.grouplens.org/datasets/movielens/ml-latest-small.zip ``` import pandas as pd import numpy as np import datetime as dt import seaborn as sns import matplotlib.pyplot as plt import math from statistics import ...
github_jupyter
# 循环 - 循环是一种控制语句块重复执行的结构 - while 适用于广度遍历 - for 开发中经常使用 ## while 循环 - 当一个条件保持真的时候while循环重复执行语句 - while 循环一定要有结束条件,否则很容易进入死循环 - while 循环的语法是: while loop-contunuation-conndition: Statement ``` master-works i = 0 while i<10: print('hahah') i += 1 ``` ## 示例: sum = 0 i = 1 while i <10: sum...
github_jupyter
## Extracting Titanic Disaster Data From Kaggle ``` !pip install python-dotenv from dotenv import load_dotenv, find_dotenv # find .env automatically by walking up directories until it's found dotenv_path = find_dotenv() # load up the entries as environment variables load_dotenv(dotenv_path) # extracting environment va...
github_jupyter
<a href="https://colab.research.google.com/github/kalz2q/mycolabnotebooks/blob/master/cpp_recursion.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # メモ 再帰は簡単かと思っていたら云々。 1. ややこしい問題、atcoder の問題を解くのに再帰を使うにはコツがありそう 1. すぐに stack overflow になるので再帰ができたらすぐに...
github_jupyter
## Some fundamental elements of programming III ### Understanding and creating correlated datasets and how to create functions As we said before, the core of data science is computer programming. To really explore data, we need to be able to write code to (1) wrangle or even generate data that has the properties...
github_jupyter
``` %matplotlib inline from matplotlib import pyplot as plt from matplotlib.patches import Circle, Wedge, Ellipse, Arc from matplotlib.collections import PatchCollection import numpy as np import subprocess as sp fig = plt.figure(figsize=(4, 4), dpi=200) ax = fig.add_subplot(111, aspect='equal') sw = 50 ew = 10 cw =...
github_jupyter
## Prep notebook ``` import bz2 import json import os import random import re import string import mwparserfromhell import numpy as np import pandas as pd import requests import findspark findspark.init('/usr/lib/spark2') from pyspark.sql import SparkSession !which python spark = ( SparkSession.builder .app...
github_jupyter
### Demonstration of Quantum Key Distribution with the Ekert 91 Protocol Algorithm - 1. First generate the a maximally entangled qubit pair |psi+> = 1/root(2) * (|01> + |10>) 2. Send one qubit to Alice and one qubit to Bob 3. Both Alice and Bob perform their measurement and make the measurement bases public. 4. Accord...
github_jupyter
# Modules Python has a way to put definitions in a file so they can easily be reused. Such files are called a modules. You can define your own module (for instance see [here](https://docs.python.org/3/tutorial/modules.html)) how to do this but in this course we will only discuss how to use existing modules as they co...
github_jupyter
# Assignment 1: Auto Correct Welcome to the first assignment of Course 2. This assignment will give you a chance to brush up on your python and probability skills. In doing so, you will implement an auto-correct system that is very effective and useful. ## Outline - [0. Overview](#0) - [0.1 Edit Distance](#0-1) -...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score #from sklearn...
github_jupyter
http://arxiv.org/pdf/1406.2661v1.pdf ...we simultaneously train two models: a generative model $G$ that captures the data distribution, and a discriminative model $D$ that estimates the probability that a sample came from the training data rather than $G$. The training procedure for $G$ is to maximize the probability o...
github_jupyter
``` import json from pathlib import Path import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import xgboost as xgb from category_encoders import OneHotEncoder from pandas_profiling import ProfileReport from sklearn.impute import SimpleImputer from sklearn.linear_model import Lo...
github_jupyter
``` ''' This notebook analyzes splicing and cleavage using LRS data. Figures 6 and S7 ''' import os import re import numpy as np import pandas as pd from pandas.api.types import CategoricalDtype import mygene import scipy from plotnine import * import warnings warnings.filterwarnings('ignore') import matplotlib matp...
github_jupyter
# Build a QA System Without Elasticsearch [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack/blob/master/tutorials/Tutorial3_Basic_QA_Pipeline_without_Elasticsearch.ipynb) Haystack provides alternatives to Elasticsearch for develop...
github_jupyter
``` from tensorflow.keras.datasets.fashion_mnist import load_data (x_train, y_train), (x_test, y_test) = load_data() print(x_train.shape, x_test.shape, y_train.shape, y_test.shape) import matplotlib.pyplot as plt import numpy as np import seaborn as sns np.random.seed(777) class_names = ['T-shirt/top', 'Trouser', '...
github_jupyter
``` import numpy as np import matplotlib import matplotlib.pyplot as plt matplotlib.style.use('ggplot') from mpl_toolkits.mplot3d import Axes3D import IPython.html.widgets as widg from IPython.display import clear_output import sys %matplotlib inline class Network: def __init__(self, shape): self.shape = np...
github_jupyter
<a href="https://colab.research.google.com/github/iamsoroush/DeepEEGAbstractor/blob/master/cv_hmdd_4s_proposed_gap.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` #@title # Clone the repository and upgrade Keras {display-mode: "form"} !git clon...
github_jupyter
# Gallery of examples ![logo_text.png](docs/source/_static/EinsteinPy_trans.png) Here you can browse a gallery of examples using EinsteinPy in the form of Jupyter notebooks. ## [Visualizing advance of perihelion of a test particle in Schwarzschild space-time](docs/source/examples/Visualizing_advance_of_perihelion_of...
github_jupyter
# Project4 : Stackworkflow Survey Results ### Import necessary libraries ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline ``` ### Load the data ``` # Load in the Stackoverflow survey results. survey_results = pd.read_csv('survey_results_public.csv') # Load in the survey...
github_jupyter
# Third Project - Automated Repair ## Overview ### The Task For the first two submissions we asked you to implement a _Debugger_ as well as an _Input Reducer_. Both of these tools are used to help the developer to locate bugs and then manually fix them. In this project, you will implement a technique of automatic c...
github_jupyter
<a href="https://colab.research.google.com/github/dcastf01/Actividad_vision_artificial/blob/main/neural_style_transfer.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neural style transfer **Author:** [fchollet](https://twitter.com/fchollet)<br> ...
github_jupyter
# Sonic The Hedgehog 1 with Advantage Actor Critic ## Step 1: Import the libraries ``` import time import retro import random import torch import numpy as np from collections import deque import matplotlib.pyplot as plt from IPython.display import clear_output import math %matplotlib inline import sys sys.path.appen...
github_jupyter
# 第一次上傳 Jupyter 使用 NLP 作業做範例 > 都已經是第一次上傳了,一切都還在摸索,不過會努力更新ㄉ. - toc: true - badges: true - comments: true - categories: [jupyter, NLP, Machine Learning] - image: images/chart-preview.png #About 本篇文章主要展現如何快速搭建資料科學相關部落格,文章內容格式可以使用 *.ipynb 或是 .word 來做撰寫。 可以先在 Local Machine 使用 ```Make server``` 開啟 Local Blog 之後,再使用 ```mak...
github_jupyter
``` from scipy.special import expit from rbmpy.rbm import RBM from rbmpy.sampler import DirtyCorrectionMulDimSampler,VanillaSampler,ContinuousSampler,ContinuousApproxSampler, ContinuousApproxMulDimSampler, ApproximatedSampler, LayerWiseApproxSampler,ApproximatedMulDimSampler from rbmpy.trainer import VanillaTrainier fr...
github_jupyter
Lambda School Data Science *Unit 1, Sprint 2, Module 4* --- # SEQUENCE YOUR NARRATIVE ASSIGNMENT Replicate the lesson code ``` # import seaborn and show version #. import seaborn as sns sns.__version__ # import the ibraries we are going to use. %matplotlib inline import matplotlib.pyplot as plt import numpy as np i...
github_jupyter
``` # Dependencies and Setup import os import pandas as pd # Files to Load school_data_to_load = r"C:\Users\matt\Desktop\pandas-challenge\Resources\schools_complete.csv" student_data_to_load = r"C:\Users\matt\Desktop\pandas-challenge\Resources\students_complete.csv" # Read School and Student Data Files school_data...
github_jupyter
# Use Case PROFAB is a benchmarking platform that is expected to fill the gap of datasets about protein functions with total 7656 datasets. In addition to protein function datasets, ProFAB provides complete sets of preprocessing-training-evaluation triangle to speed up machine learning usage in biological studies. Sin...
github_jupyter
# Objected-Oriented Simulation Up to this point we have been using Python generators and shared resources as the building blocks for simulations of complex systems. This can be effective, particularly if the individual agents do not require access to the internal state of other agents. But there are situations where ...
github_jupyter
# 01 - Introduction to numpy: why does numpy exist? You might have read somewhere that Python is "slow" in comparison to some other languages. While generally true, this statement has only little meaning without context. As a scripting language (e.g. simplify tasks such as file renaming, data download, etc.), python i...
github_jupyter
<img src="https://github.com/pmservice/ai-openscale-tutorials/raw/master/notebooks/images/banner.png" align="left" alt="banner"> # Working with Watson Machine Learning - Quality Monitor and Feedback Logging ### Contents - [1.0 Install Python Packages](#setup) - [2.0 Configure Credentials](#credentials) - [3.0 OpenSc...
github_jupyter
``` # importamos librerias necesarias %matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd # importando dataset becariospdb = pd.read_csv('perdidadebecas.csv') print(becariospdb.head(1)) # Tenemos como objetivo predecir el motivo por el cual puede renunciar un becario # Para usar ...
github_jupyter
this notebook first collect all stats obtained in intial exploration. it will be a big table, indexed by subset, neuron, structure, optimization. # result: I will use k9cX + k6s2 + vanilla as my basis. ``` import h5py import numpy as np import os.path from functools import partial from collections import OrderedDic...
github_jupyter
# Prescient Tutorial ## Getting Started This is a tutorial to demonstration the basic functionality of Prescient. Please follow the installation instructions in the [README](https://github.com/grid-parity-exchange/Prescient/blob/master/README.md) before proceeding. This tutorial will assume we are using the CBC MIP so...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import pandas as pd #delimiter = "\t" means tab #quoting = 3 means we are ignoring the double quotes in the dataset dataset = pd.read_csv('Restaurant_Reviews.tsv', delimiter='\t', quoting = 3) #use vpn so that stopwords can be downloaded #importing text cleaning l...
github_jupyter
# Deep Learning Intro ``` %matplotlib inline import matplotlib.pyplot as plt import pandas as pd import numpy as np ``` ## Exercise 1 The [Pima Indians dataset](https://archive.ics.uci.edu/ml/datasets/Pima+Indians+Diabetes) is a very famous dataset distributed by UCI and originally collected from the National Instit...
github_jupyter
# 14 Linear Algebra: String Problem – Students (1) ## Motivating problem: Two masses on three strings Two masses $M_1$ and $M_2$ are hung from a horizontal rod with length $L$ in such a way that a rope of length $L_1$ connects the left end of the rod to $M_1$, a rope of length $L_2$ connects $M_1$ and $M_2$, and a rope...
github_jupyter
# Prédiction à l'aide de forêts aléatoires Les forêts aléatoires sont des modèles de bagging ne nécessitant pas beaucoup de *fine tuning* pour obtenir des performances correctes. De plus, ces méthodes sont plus résitances au surapprentissage par rapport à d'autres méthodes. ``` from google.colab import drive drive.mo...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline import torch import torchvision from torch import nn from torch import optim import torch.nn.functional as F from torch.autograd import Variable from torch.utils.data import DataLoader from torchvision i...
github_jupyter
# Deutsch-Jozsa and Grover with Aqua The Aqua library in Qiskit implements some common algorithms so that they can be used without needing to program the circuits for each case. In this notebook, we will show how we can use the Deutsch-Jozsa and Grover algorithms. ## Detusch-Jozsa To use the Deutsch-Jozsa algorithm,...
github_jupyter
# Facial Keypoint Detection This project will be all about defining and training a convolutional neural network to perform facial keypoint detection, and using computer vision techniques to transform images of faces. The first step in any challenge like this will be to load and visualize the data you'll be working ...
github_jupyter
<a href="https://colab.research.google.com/github/enakai00/rl_book_solutions/blob/master/Chapter05/Exercise_5_12.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Exercise 5.12 : Solution ``` import numpy as np from numpy import random import copy ...
github_jupyter
Genetic Algorithm ``` import random as rnd # returns the random array def random_arr(lower, upper, size): return [rnd.randrange(lower, upper+1) for _ in range(size)] # cross over between chromosomes def reproduce(x, y): tmp = rnd.randint(0, len(x)-1) return x[:tmp]+y[tmp:] # randomly change the value of in...
github_jupyter
<a href="https://colab.research.google.com/github/isb-cgc/Community-Notebooks/blob/master/Notebooks/How_to_use_the_Reactome_BQ_dataset.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # How to use the Reactome BigQuery dataset Check out other noteboo...
github_jupyter
``` %matplotlib inline %load_ext autoreload %autoreload 2 import sys from pathlib import Path sys.path.append(str(Path.cwd().parent)) import numpy as np import pandas as pd import matplotlib.pyplot as plt import plotting from statsmodels.tsa.stattools import adfuller from statsmodels.graphics.tsaplots import plot_acf,...
github_jupyter
# <div style="text-align: center">A Data Science Framework for Quora </div> ### <div align="center"><b>Quite Practical and Far from any Theoretical Concepts</b></div> <img src='http://s9.picofile.com/file/8342477368/kq.png'> <div style="text-align:center">last update: <b>11/15/2018</b></div> You can Fork and Run this ...
github_jupyter
``` import requests import pytesseract import os from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity print ('Starting to Download!') url = 'https://images.sampletemplates.com/wp-content/uploads/2017/04/Technical-Paper-Example1.jpg' r = requests.get(url) fil...
github_jupyter
# Logistic Regression with a Neural Network mindset Welcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and so will also hone your intuitions about deep learning....
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt from os import listdir, mkdir import numpy as np from shutil import copy2 # reproducible randomness from numpy.random import RandomState df = pd.read_csv('./training_solutions_rev1.csv') print(df.count()) # show total number of samples print(df.head()) # showcase...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import miepython as mp import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl mpl.rcParams["xtick.direction"] = "in" mpl.rcParams["ytick.direction"] = "in" mpl.rcParams["lines.markeredgecolor"] = "k" mpl.rcParams["lines.markeredgewidth"] = 1 m...
github_jupyter
# Get Data ``` import os import zipfile import urllib DOWNLOAD_ROOT = "https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data" IRIS_PATH = os.path.join("datasets", "iris") IRIS_URL = DOWNLOAD_ROOT def extract_iris_data(iris_url=IRIS_URL,iris_path=IRIS_PATH): if not os.path.isdir(iris_path): ...
github_jupyter
# Ray RLlib - Overview © 2019-2020, Anyscale. All Rights Reserved ![Anyscale Academy](../images/AnyscaleAcademyLogo.png) ## Join Us at Ray Summit 2020! Join us for the [_free_ Ray Summit 2020 virtual conference](https://events.linuxfoundation.org/ray-summit/?utm_source=dean&utm_medium=embed&utm_campaign=ray_summit&...
github_jupyter
<font size="+0.5">Notebook for transform data format to train the model<font> # <center> Data transform ``` import matplotlib.pyplot as plt import numpy as np import pandas as pd import os from datetime import datetime from scipy.signal import savgol_filter from sklearn.utils import shuffle # Timestamp form in init...
github_jupyter
``` import matplotlib import matplotlib.pyplot as plt plt.style.use("ggplot") %matplotlib inline plt.rcParams["figure.figsize"] = "15, 8" import pandas as pd import numpy as np import seaborn as sns #http://stackoverflow.com/questions/8897593/similarity-between-two-text-documents import nltk, string from sklearn.featu...
github_jupyter
# 🌋 Quick Feature Tour [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/RelevanceAI/RelevanceAI-readme-docs/blob/v2.0.0/docs/getting-started/_notebooks/RelevanceAI-ReadMe-Quick-Feature-Tour.ipynb) ### 1. Set up Relevance AI Get started using our R...
github_jupyter
## Updating Constraint Matrices To implement Graph SLAM, a matrix and a vector (omega and xi, respectively) are introduced. The matrix is square and labelled with all the robot poses (xi) and all the landmarks (Li). Every time you make an observation, for example, as you move between two poses by some distance `dx` an...
github_jupyter
![Brazil Flag](http://www.brazil.org.za/brazil-images/brazil-flag.png) ### <center> **Chukwuemeka Mba-Kalu** </center> <center> **Joseph Onwughalu** </center> ### <center> **An Analysis of the Brazilian Economy between 2000 and 2012** </center> #### <center> Final Project In Partial Fulfillment of the Course Requireme...
github_jupyter
``` """ The MIT License (MIT) Copyright (c) 2021 NVIDIA Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, pub...
github_jupyter
``` # Allow us to load `open_cp` without installing import sys, os.path sys.path.insert(0, os.path.abspath(os.path.join("..", ".."))) ``` # Chicago data The data can be downloaded from https://catalog.data.gov/dataset/crimes-2001-to-present-398a4 (see the module docstring of `open_cp.sources.chicago` See also https:...
github_jupyter
# Build and Evaluate a Linear Risk model Welcome to the first assignment in Course 2! ## Outline - [1. Import Packages](#1) - [2. Load Data](#2) - [3. Explore the Dataset](#3) - [4. Mean-Normalize the Data](#4) - [Exercise 1](#Ex-1) - [5. Build the Model](#Ex-2) - [Exercise 2](#Ex-2) - [6. Evaluate the Model...
github_jupyter
``` import queue class Intcode: def __init__(self, intcode=None, inputs=None, outputs=None, manual=True): if intcode == None: self.intcode = [99] self.inputs = inputs if inputs == None: self.inputs = queue.Queue() if type(inputs) == list: q = inpu...
github_jupyter
# CHEM 1000 - Spring 2022 Prof. Geoffrey Hutchison, University of Pittsburgh ## 1. Functions and Coordinate Sets Chapter 1 in [*Mathematical Methods for Chemists*](http://sites.bu.edu/straub/mathematical-methods-for-molecular-science/) By the end of this session, you should be able to: - Handle 2D polar and 3D spher...
github_jupyter
Before you turn this problem in, make sure everything runs as expected. First, **restart the kernel** (in the menubar, select Kernel$\rightarrow$Restart) and then **run all cells** (in the menubar, select Cell$\rightarrow$Run All). Make sure you fill in any place that says `YOUR CODE HERE` or "YOUR ANSWER HERE", as we...
github_jupyter
# Example for an analytical solution of weakly scattering sphere in Python In this example the analytical solution for a weakly scattering sphere is based on Anderson, V. C., "Sound scattering from a fluid sphere", J. Acoust. Soc. America, 22 (4), pp 426-431, July 1950 is computed in it's original form and the simpl...
github_jupyter
``` import os import wave import contextlib from pathlib import Path from google.colab import files from os import listdir import sys from keras.preprocessing.image import load_img from keras.preprocessing.image import img_to_array from keras import backend from numpy import zeros from sklearn.metrics import fbeta_sco...
github_jupyter
# Patterns 2 ``` n=int(input()) i=1 while n>=i: #spaces spaces = 1 while n-i>=spaces: print(' ',end='') spaces+=1 #increasing stars = 1 while i>=stars: print('*',end='') stars+=1 #decreasing p=i-1 while p>=1: print('*',end='') ...
github_jupyter