text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` import sys import json sys.path.insert(0, "../") print(sys.path) import pymongo #31470/5/1 import sys import json import cobrakbase import cobrakbase.core.model import cobra import logging #from cobra.core import Gene, Metabolite, Model, Reaction #from pyeda import * #from pyeda.inter import * #from pyeda.boolalg i...
github_jupyter
``` import matplotlib.pyplot as plt import pandas as pd import numpy as np from sklearn.linear_model import LogisticRegression from sklearn import metrics from sklearn.metrics import classification_report, confusion_matrix, f1_score from sklearn.metrics import make_scorer, f1_score, accuracy_score, recall_score, precis...
github_jupyter
``` # importing import tensorflow as tf import matplotlib.pyplot as plt import os # loading images path_dir = "/content/drive/MyDrive/Dataset/malariya_cell_data_set/cell_images/" loaded = 0 path = path_dir+"Uninfected/" uninfected_list = os.listdir(path) path = path_dir + "Parasitized" infected_list = os.listdir(path...
github_jupyter
# Homework 5: Problems ## Due Wednesday 28 October, before class ### PHYS 440/540, Fall 2020 https://github.com/gtrichards/PHYS_440_540/ ## Problems 1&2 Complete Chapters 1 and 2 in the *unsupervised learning* course in Data Camp. The last video (and the two following code examples) in Chapter 2 are off topic, but...
github_jupyter
### Dataset Source: About this file Boston House Price dataset ### columns: * CRIM per capita crime rate by town * ZN proportion of residential land zoned for lots over 25,000 sq.ft. * INDUS proportion of non-retail business acres per town * CHAS Charles River dummy variable (= 1 if tract bounds rive...
github_jupyter
# 第5章 計算機を作る ## 5.1.2 スタックマシン ``` def calc(expression: str): # 空白で分割して字句にする tokens = expression.split() stack = [] for token in tokens: if token.isdigit(): # 数値はスタックに push する stack.append(int(token)) continue # 数値でないなら,演算子として処理する x = sta...
github_jupyter
# A Whirlwind Tour of Python *Jake VanderPlas, Summer 2016* These are the Jupyter Notebooks behind my O'Reilly report, [*A Whirlwind Tour of Python*](http://www.oreilly.com/programming/free/a-whirlwind-tour-of-python.csp). The full notebook listing is available [on Github](https://github.com/jakevdp/WhirlwindTourOfPy...
github_jupyter
``` epochs = 5 ``` # Example - Simple Vertically Partitioned Split Neural Network - <b>Alice</b> - Has model Segment 1 - Has the handwritten Images - <b>Bob</b> - Has model Segment 2 - Has the image Labels Based on [SplitNN - Tutorial 3](https://github.com/OpenMined/PySyft/blob/master/examples/tu...
github_jupyter
## 1-3. 複数量子ビットの記述 ここまでは1量子ビットの状態とその操作(演算)の記述について学んできた。この章の締めくくりとして、$n$個の量子ビットがある場合の状態の記述について学んでいこう。テンソル積がたくさん出てきてややこしいが、コードをいじりながら身につけていってほしい。 $n$個の**古典**ビットの状態は$n$個の$0,1$の数字によって表現され、そのパターンの総数は$2^n$個ある。 量子力学では、これらすべてのパターンの重ね合わせ状態が許されているので、$n$個の**量子**ビットの状態$|\psi \rangle$はどのビット列がどのような重みで重ね合わせになっているかという$2^n$個の複素確率振幅で記...
github_jupyter
``` %matplotlib inline from __future__ import print_function, unicode_literals import sys, os import seaborn as sns import numpy as np import matplotlib from matplotlib import pyplot as plt from pygaarst import raster sys.path.append('../firedetection/') import landsat8fire as lfire sns.set(rc={'image.cmap': 'gist_heat...
github_jupyter
# Finding fraud patterns with FP-growth # Data Collection and Investigation ``` import pandas as pd # Input data files are available in the "../input/" directory df = pd.read_csv('D:/Python Project/Credit Card Fraud Detection/benchmark dataset/Test FP-Growth.csv') # printing the first 5 columns for data visualizati...
github_jupyter
``` ### MODULE 1 ### Basic Modeling in scikit-learn ``` ``` ### Seen vs. unseen data # The model is fit using X_train and y_train model.fit(X_train, y_train) # Create vectors of predictions train_predictions = model.predict(X_train) test_predictions = model.predict(X_test) # Train/Test Errors train_error = mae(y_tr...
github_jupyter
# Goals ### Learn how to change train validation splits # Table of Contents ## [0. Install](#0) ## [1. Load experiment with defaut transforms](#1) ## [2. Reset Transforms andapply new transforms](#2) <a id='0'></a> # Install Monk - git clone https://github.com/Tessellate-Imaging/monk_v1.git - cd monk_v...
github_jupyter
``` import pandas as pd import numpy as np import numpy.random as nr import matplotlib.pyplot as plt import matplotlib.pyplot as plt import sklearn from sklearn.ensemble import RandomForestClassifier import catboost as cat from catboost import CatBoostClassifier from sklearn import preprocessing import sklearn.model_se...
github_jupyter
# Dataproc - Submit Hadoop Job ## Intended Use A Kubeflow Pipeline component to submit a Apache Hadoop MapReduce job on Apache Hadoop YARN in Google Cloud Dataproc service. ## Run-Time Parameters: Name | Description :--- | :---------- project_id | Required. The ID of the Google Cloud Platform project that the cluste...
github_jupyter
<div> <img src="https://drive.google.com/uc?export=view&id=1vK33e_EqaHgBHcbRV_m38hx6IkG0blK_" width="350"/> </div> #**Artificial Intelligence - MSc** This notebook is designed specially for the module ET5003 - MACHINE LEARNING APPLICATIONS Instructor: Enrique Naredo ###ET5003_BayesianNN © All rights reserved to t...
github_jupyter
# Simple Attack In this notebook, we will examine perhaps the simplest possible attack on an individual's private data and what the OpenDP library can do to mitigate it. ## Loading the data The vetting process is currently underway for the code in the OpenDP Library. Any constructors that have not been vetted may st...
github_jupyter
``` import tensorflow as tf import h5py import shutil import numpy as np from torch.utils.data import DataLoader import keras from tqdm.notebook import tqdm from keras.models import Sequential from keras.layers import Dense, Flatten, Conv3D, Dropout, MaxPooling3D,MaxPooling2D from keras.utils import to_categorical from...
github_jupyter
# 1. Python and notebook basics In this first chapter, we will cover the very essentials of Python and notebooks such as creating a variable, importing packages, using functions, seeing how variables behave in the notebook etc. We will see more details on some of these topics, but this very short introduction will the...
github_jupyter
**Create Train / Dev / Test files. <br> Each file is a dictionary where each key represent the ID of a certain Author and each value is a dict where the keys are : <br> - author_embedding : the Node embedding that correspond to the author (tensor of shape (128,)) <br> - papers_embedding : the abstract embedding of ever...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline # x = Acos(k/m t + \theta) = 1 # p = mx' = Ak/m sin(k/m t + \theta) t = np.linspace(0, 2 * np.pi, 100) t ``` # Exact Equation ``` x, p = np.cos(t - np.pi), -np.sin(t - np.pi) fig = plt.figure(figsize...
github_jupyter
# Dependencies ``` import os import random import warnings import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from sklearn.utils import class_weight from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix, cohen_kappa_score from keras ...
github_jupyter
# Task: Predict User Item response under uniform exposure while learning from biased training data ŒMany current applications use recommendations in order to modify the natural user behavior, such as to increase the number of sales or the time spent on a website. This results in a gap between the final recommendation ...
github_jupyter
# Ray RLlib - Introduction to Reinforcement Learning © 2019-2021, Anyscale. All Rights Reserved ![Anyscale Academy](../images/AnyscaleAcademyLogo.png) _Reinforcement Learning_ is the category of machine learning that focuses on training one or more _agents_ to achieve maximal _rewards_ while operating in an environm...
github_jupyter
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_05_2_kfold.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # T81-558: Applications of Deep Neural Networks **Module 5: Regularization and Dr...
github_jupyter
# OOP Syntax Exercise - Part 2 Now that you've had some practice instantiating objects, it's time to write your own class from scratch. This lesson has two parts. In the first part, you'll write a Pants class. This class is similar to the shirt class with a couple of changes. Then you'll practice instantiating Pants o...
github_jupyter
# YBIGTA ML PROJECT / 염정운 ## Setting ``` import numpy as np import pandas as pd pd.set_option("max_columns", 999) pd.set_option("max_rows", 999) from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier import seaborn as sns import matplotlib.pyplot as plt #sns.set(rc={'figu...
github_jupyter
<a href="https://colab.research.google.com/github/tuanavu/deep-learning-tutorials/blob/development/colab-example-notebooks/colab_github_demo.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Using Google Colab with GitHub [Google Colaboratory](htt...
github_jupyter
``` # Parameters # Build the dataset from typing import Optional import pandas as pd import functools def add_parent_level(df: pd.DataFrame, name: str) -> None: df.columns = pd.MultiIndex.from_tuples([(name, x) for x in df.columns]) def calculate_limit(row: pd.Series, attribute: str) -> Optional[float]: ro...
github_jupyter
# Cowell's formulation For cases where we only study the gravitational forces, solving the Kepler's equation is enough to propagate the orbit forward in time. However, when we want to take perturbations that deviate from Keplerian forces into account, we need a more complex method to solve our initial value problem: o...
github_jupyter
``` import os, time, datetime import numpy as np import pandas as pd from tqdm.notebook import tqdm import random import logging tqdm.pandas() import seaborn as sns from sklearn.model_selection import train_test_split #NN Packages import torch import torch.nn as nn from torch.utils.data import TensorDataset, random_sp...
github_jupyter
# Optimization Things to try: - change the number of samples - without and without bias - with and without regularization - changing the number of layers - changing the amount of noise - change number of degrees - look at parameter values (high) in OLS - tarin network for many epochs ``` from fastprogress.fastprogre...
github_jupyter
## Hybrid Neural Net to solve Regression Problem We use a neural net with a quantum layer to predict the second half betting lines given the result of the first half and the opening line. The quantum layer is an 8 qubit layer and the model is from Keras. ``` import pandas as pd import numpy as np import tensorflow as...
github_jupyter
<a id='1'></a> # 1. Import packages ``` from keras.models import Sequential, Model from keras.layers import * from keras.layers.advanced_activations import LeakyReLU from keras.activations import relu from keras.initializers import RandomNormal from keras.applications import * import keras.backend as K from tensorflow...
github_jupyter
# Unsplash Joint Query Search Using this notebook you can search for images from the [Unsplash Dataset](https://unsplash.com/data) using natural language queries. The search is powered by OpenAI's [CLIP](https://github.com/openai/CLIP) neural network. This notebook uses the precomputed feature vectors for almost 2 mi...
github_jupyter
# RadarCOVID-Report ## Data Extraction ``` import datetime import json import logging import os import shutil import tempfile import textwrap import uuid import matplotlib.pyplot as plt import matplotlib.ticker import numpy as np import pandas as pd import pycountry import retry import seaborn as sns %matplotlib in...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt ``` # BCC and FCC ``` def average_quantities(E_list,V_list,S_list,Comp_list): average_E_list=np.empty(len(Comp_list)) average_S_list=np.empty(len(Comp_list)) average_V_list=np.empty(len(Comp_list)) average_b_list=np.empty(len(Comp_list)) avera...
github_jupyter
# Implement an Accelerometer In this notebook you will define your own `get_derivative_from_data` function and use it to differentiate position data ONCE to get velocity information and then again to get acceleration information. In part 1 I will demonstrate what this process looks like and then in part 2 you'll imple...
github_jupyter
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-59152712-8"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-59152712-8'); </script> # Weyl Scalars and Invariants: An Introduction to Einstein ...
github_jupyter
# Setup ### Installing Dependencies and Mounting ``` %%capture !pip install transformers # Mount Google Drive from google.colab import drive # import drive from google colab ROOT = "/content/drive" drive.mount(ROOT, force_remount=True) ``` ### Imports ``` import pandas as pd import numpy as np import seaborn as s...
github_jupyter
## Define the Convolutional Neural Network In this notebook and in `models.py`: 1. Define a CNN with images as input and keypoints as output 2. Construct the transformed FaceKeypointsDataset, just as before 3. Train the CNN on the training data, tracking loss 4. See how the trained model performs on test data 5. If ne...
github_jupyter
## Dependencies ``` import json, warnings, shutil from tweet_utility_scripts import * from tweet_utility_preprocess_roberta_scripts import * from transformers import TFRobertaModel, RobertaConfig from tokenizers import ByteLevelBPETokenizer from tensorflow.keras.models import Model from tensorflow.keras import optimiz...
github_jupyter
``` # Import modules from __future__ import print_function import numpy as np import matplotlib.pyplot as plt # Plot configurations %matplotlib inline # Notebook auto reloads code. %load_ext autoreload %autoreload 2 ``` # NeuroTorch Tutorial **NeuroTorch** is a framework for reconstructing neuronal morphology from ...
github_jupyter
# Data Similarity Previous experiments have had some strange results, with models occasionally performing abnormally well (or badly) on the out of sample set. To make sure that there are no duplicate samples or abnormally similar studies, I made this notebook ``` import json import matplotlib.pyplot as plt import num...
github_jupyter
# Getting started in scikit-learn with the famous iris dataset *From the video series: [Introduction to machine learning with scikit-learn](https://github.com/justmarkham/scikit-learn-videos)* ``` #environment setup with watermark %load_ext watermark %watermark -a 'Gopala KR' -u -d -v -p watermark,numpy,pandas,matplot...
github_jupyter
# How to Use Forecasters in Merlion This notebook will guide you through using all the key features of forecasters in Merlion. Specifically, we will explain 1. Initializing a forecasting model (including ensembles and automatic model selectors) 1. Training the model 1. Producing a forecast with the model 1. Visualizi...
github_jupyter
# Strings ``` name = "Robin" ``` ## Multi line strings ``` paragraph = "I am thinking of writing something that spans"\ "multiple lines and Nobody is helping me with that. So here"\ "is me typing something random" print(paragraph) # \n represents Newline paragraph = "I am thinking of writing something that spans\n\ ...
github_jupyter
###Set up working directory ``` cd /usr/local/notebooks mkdir -p ./workdir #check seqfile files to process in data directory (make sure you still remember the data directory) !ls ./data/test/data ``` #README ## This part of pipeline search for the SSU rRNA gene fragments, classify them, and extract reads aligned spe...
github_jupyter
``` import numpy import sys import nmslib import time import math from sklearn.neighbors import NearestNeighbors from sklearn.model_selection import train_test_split # Just read the data all_data_matrix = numpy.loadtxt('../../sample_data/sift_10k.txt') # Create a held-out query data set (data_matrix, query_matrix)...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') from google.colab import auth auth.authenticate_user() import gspread from oauth2client.client import GoogleCredentials gc = gspread.authorize(GoogleCredentials.get_application_default()) cd drive/"My Drive"/"Colab Notebooks"/master_project/evaluation %%...
github_jupyter
``` class Solution: def removeInvalidParentheses(self, s: str): if not s: return [] self.max_len = self.get_max_len(s) self.ans = [] self.dfs(s, 0, "", 0) return self.ans def dfs(self, s, idx, cur_str, count): if len(cur_str) > self.max_len: return i...
github_jupyter
``` emails = ['assc.bem.fazer@sapo.pt', 'amcdrvaledeazares@hotmail.com', 'asccm@sapo.pt', 'cercimb.sede@gmail.com', 'centro.paroq.ereira@mail.telepac.pt', 'apiterena@sapo.pt', 'geral@csouca.pt', 'RPFALVES@APPC.PT', 'centrosocialmeas@gmail.com', 'dts.iscmfa@gmail.com', 'ribeiracavado@gmail.com', 'recolhimentolapa@lapa.p...
github_jupyter
# 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's first load the entire adult dataset containing both numerical and categorical data. ``` import pandas as pd adult...
github_jupyter
# TEST for matrix_facto_10_embeddings_100_epochs # Deep recommender on top of Amason’s Clean Clothing Shoes and Jewelry explicit rating dataset Frame the recommendation system as a rating prediction machine learning problem and create a hybrid architecture that mixes the collaborative and content based filtering appr...
github_jupyter
# Description This notebook is used to request computation of average time-series of a WaPOR data layer for an area using WaPOR API. You will need WaPOR API Token to use this notebook # Step 1: Read APIToken Get your APItoken from https://wapor.apps.fao.org/profile. Enter your API Token when running the cell below....
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import RandomForestRegressor from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split, cross_val_score from sklearn import metrics from s...
github_jupyter
``` %%html <link href="http://mathbook.pugetsound.edu/beta/mathbook-content.css" rel="stylesheet" type="text/css" /> <link href="https://aimath.org/mathbook/mathbook-add-on.css" rel="stylesheet" type="text/css" /> <style>.subtitle {font-size:medium; display:block}</style> <link href="https://fonts.googleapis.com/css?fa...
github_jupyter
``` from matplotlib import pyplot as plt import pandas as pd import seaborn as sns from matplotlib import rcParams import numpy as np %matplotlib inline rcParams['font.sans-serif'] = 'arial' pal = sns.xkcd_palette(['dark sky blue', 'light sky blue', 'deep red']).as_hex() imprinting_df = pd.read_csv('../data/imprintin...
github_jupyter
# Gradient-boosting decision tree (GBDT) In this notebook, we will present the gradient boosting decision tree algorithm and contrast it with AdaBoost. Gradient-boosting differs from AdaBoost due to the following reason: instead of assigning weights to specific samples, GBDT will fit a decision tree on the residuals ...
github_jupyter
# Introduction ## 1.1 Some Apparently Simple Questions ## 1.2 An Alternative Analytic Framework Solved to a high degree of accuracy using numerical method ``` !pip install --user quantecon import numpy as np import numpy.linalg as la from numba import * from __future__ import division #from quantecon.quad import ...
github_jupyter
## Linear Algebra Those exercises will involve vector and matrix math, the <a href="http://wiki.scipy.org/Tentative_NumPy_Tutorial">NumPy</a> Python package. This exercise will be divided into two parts: #### 1. Math checkup Where you will do some of the math by hand. #### 2. NumPy and Spark linear algebra You ...
github_jupyter
# Metadata Organization ## Imports ``` import pandas as pd import numpy as np import os.path import glob import pathlib import functools import time import re import gc from nilearn.input_data import NiftiMasker import nibabel as nib from nilearn import image from joblib import Parallel, delayed ``` ## Load confi...
github_jupyter
``` import numpy as np %matplotlib notebook import matplotlib.pyplot as plt nu = np.linspace(1e9, 200e9) ElectronCharge = 4.803e-10 ElectronMass = 9.1094e-28 SpeedLight = 3e10 def plot_ql_approx(magField, thetaDeg, plasmaDens, ax=None): gyroFreq = ElectronCharge * magField / (2 * np.pi * ElectronMass * SpeedLight)...
github_jupyter
# GIS web services ## Web Map Service / Web Coverage Service A Web Map Service (WMS) is an Open Geospatial Consortium (OGC) standard that allows users to remotely access georeferenced map images via secure hypertext transfer protocol (HTTPS) requests. DE Africa provides two types of maps services: * Web Map Service...
github_jupyter
# Useful modules in standard library --- **Programming Language** - Core Feature + builtin with language, + e.g input(), all(), for, if - Standard Library + comes preinstalled with language installer + e.g datetime, csv, Fraction - Thirdparty Library + created by community to solve specific pro...
github_jupyter
# Inheritance with the Gaussian Class To give another example of inheritance, take a look at the code in this Jupyter notebook. The Gaussian distribution code is refactored into a generic Distribution class and a Gaussian distribution class. Read through the code in this Jupyter notebook to see how the code works. Th...
github_jupyter
*Accompanying code examples of the book "Introduction to Artificial Neural Networks and Deep Learning: A Practical Guide with Applications in Python" by [Sebastian Raschka](https://sebastianraschka.com). All code examples are released under the [MIT license](https://github.com/rasbt/deep-learning-book/blob/master/LICEN...
github_jupyter
# A Basic Model In this example application it is shown how a simple time series model can be developed to simulate groundwater levels. The recharge (calculated as precipitation minus evaporation) is used as the explanatory time series. ``` import matplotlib.pyplot as plt import pandas as pd import pastas as ps ps....
github_jupyter
``` from IPython import display from torch.utils.data import DataLoader from torchvision import transforms, datasets from utils import Logger import tensorflow as tf import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import numpy as np DATA_FOLDER = './tf_data/VGAN/MNIST' IMAGE_PIXELS = 28*28 NOISE_SIZE = ...
github_jupyter
## Set up the dependencies ``` # for reading and validating data import emeval.input.spec_details as eisd import emeval.input.phone_view as eipv import emeval.input.eval_view as eiev import arrow # Visualization helpers import emeval.viz.phone_view as ezpv import emeval.viz.eval_view as ezev # For plots import matplot...
github_jupyter
# Get all tracts within certain cities Given a CSV file containing city names, get all the tracts within those cities' boundaries. ``` import geopandas as gpd import json import os import pandas as pd all_tracts_path = 'data/us_census_tracts_2014' places_path = 'data/us_census_places_2014' states_by_fips_path = 'dat...
github_jupyter
## Computing native contacts with MDTraj Using the definition from Best, Hummer, and Eaton, "Native contacts determine protein folding mechanisms in atomistic simulations" PNAS (2013) [10.1073/pnas.1311599110](http://dx.doi.org/10.1073/pnas.1311599110) Eq. (1) of the SI defines the expression for the fraction of nati...
github_jupyter
First, load the data, from the supplied data file ``` import tarfile import json import gzip import pandas as pd import botometer from pandas.io.json import json_normalize ## VARIABLE INITIATION tar = tarfile.open("../input/2017-09-22.tar.gz", "r:gz") mashape_key = "QRraJnMT9KmshkpJ7iu74xKFN1jtp1IyBBijsnS5NGbEuwIX54"...
github_jupyter
Wayne H Nixalo - 09 Aug 2017 FADL2 L9: Generative Models neural-style-GPU.ipynb ``` %matplotlib inline import importlib import os, sys sys.path.insert(1, os.path.join('../utils')) from utils2 import * from scipy.optimize import fmin_l_bfgs_b from scipy.misc import imsave from keras import metrics from vgg16_avg im...
github_jupyter
# The Central Limit Theorem Elements of Data Science by [Allen Downey](https://allendowney.com) [MIT License](https://opensource.org/licenses/MIT) ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt # If we're running on Colab, install empiricaldist # https://pypi.org/project/empiricaldist/ ...
github_jupyter
# Qcodes example with Alazar ATS 9360 ``` # import all necessary things %matplotlib nbagg import qcodes as qc import qcodes.instrument.parameter as parameter import qcodes.instrument_drivers.AlazarTech.ATS9360 as ATSdriver import qcodes.instrument_drivers.AlazarTech.ATS_acquisition_controllers as ats_contr # Command ...
github_jupyter
# Assignment 2: Parts-of-Speech Tagging (POS) Welcome to the second assignment of Course 2 in the Natural Language Processing specialization. This assignment will develop skills in part-of-speech (POS) tagging, the process of assigning a part-of-speech tag (Noun, Verb, Adjective...) to each word in an input text. Tag...
github_jupyter
# <center>RumbleDB sandbox</center> This is a RumbleDB sandbox that allows you to play with simple JSONiq queries. It is a jupyter notebook that you can also download and execute on your own machine, but if you arrived here from the RumbleDB website, it is likely to be shown within Google's Colab environment. To get...
github_jupyter
# Aggregating statistics ``` import pandas as pd air_quality = pd.read_pickle('air_quality.pkl') air_quality.info() ``` ### Series/one column of a DataFrame ``` air_quality['TEMP'].count() air_quality['TEMP'].mean() air_quality['TEMP'].std() air_quality['TEMP'].min() air_quality['TEMP'].max() air_quality['TEMP'].qua...
github_jupyter
``` # 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 # For example, here's several helpful packages to load in import numpy as np # linear algebra import pandas as pd # data processing, CSV file...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # Explore Duplicate Question Matches Use this dashboard to explore the relationship between duplicate and original questions. ## Setup This section loads needed packages, and defines useful functions. ``` from __future__ impo...
github_jupyter
<a href="https://colab.research.google.com/github/PytorchLightning/pytorch-lightning/blob/master/notebooks/04-transformers-text-classification.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Finetune 🤗 Transformers Models with PyTorch Lightning ⚡...
github_jupyter
# Anomaly detection Anomaly detection is a machine learning task that consists in spotting so-called outliers. “An outlier is an observation in a data set which appears to be inconsistent with the remainder of that set of data.” Johnson 1992 “An outlier is an observation which deviates so much from the other observa...
github_jupyter
# Intro to machine learning - k-means --- Scikit-learn has a nice set of unsupervised learning routines which can be used to explore clustering in the parameter space. In this notebook we will use k-means, included in Scikit-learn, to demonstrate how the different rocks occupy different regions in the available param...
github_jupyter
# Beating the betting firms with linear models * **Data Source:** [https://www.kaggle.com/hugomathien/soccer](https://www.kaggle.com/hugomathien/soccer) * **Author:** Anders Munk-Nielsen **Result:** It is possible to do better than the professional betting firms in terms of predicting each outcome (although they may ...
github_jupyter
# Assignment 2: Naive Bayes Welcome to week two of this specialization. You will learn about Naive Bayes. Concretely, you will be using Naive Bayes for sentiment analysis on tweets. Given a tweet, you will decide if it has a positive sentiment or a negative one. Specifically you will: * Train a naive bayes model on a...
github_jupyter
``` import keras keras.__version__ ``` # Using a pre-trained convnet This notebook contains the code sample found in Chapter 5, Section 3 of [Deep Learning with Python](https://www.manning.com/books/deep-learning-with-python?a_aid=keras&a_bid=76564dff). Note that the original text features far more content, in partic...
github_jupyter
# Filled Julia set ___ Let $C\in \mathbb{C}$ is fixed. A *Filled Julia set* $K_C$ is the set of $z\in \mathbb{C}$ which satisfy $\ f^n_C(z)$ $(n \ge 1)$is bounded : $$K_C = \bigl\{ z\in \mathbb{C}\bigm|\{f^n_C(z)\}_{n\ge 1} : bounded\bigr\},$$ where $\ \ f^1_C(z) = f_C(z) = z^2 + C $, $\ \ f^n_C = f^{n-1}_C \circ f_C$...
github_jupyter
``` !conda install --yes scikit-learn !conda install --yes matplotlib !conda install --yes seaborn from sklearn.feature_selection import SelectFromModel from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import confusion_matrix from sklearn impo...
github_jupyter
# 2. Beyond simple plotting --- In this lecture we'll go a bit further with plotting. We will: - Create figures of different sizes; - Use Numpy to generate data for plotting; - Further change the appearance of our plots; - Add multiple axes to the same figure. ``` from matplotlib import pyplot as plt %matplotlib i...
github_jupyter
# Gromos Tutorial Pipeline ``` import os, sys from pygromos.utils import bash root_dir = os.getcwd() #if package is not installed and path not set correct - this helps you out :) sys.path.append(root_dir+"/..") import pygromos from pygromos.gromos.gromosPP import GromosPP from pygromos.gromos.gromosXX import Gromos...
github_jupyter
``` import os from glob import glob import random import torch from torchvision import datasets as dset from torchvision import transforms from matplotlib import pyplot as plt from torch.utils.data import DataLoader, Dataset from tqdm.notebook import tqdm from siamesenet import SiameseNet from arguments import get_co...
github_jupyter
``` import numpy as np import heron import heron.models.georgebased generator = heron.models.georgebased.Heron2dHodlrIMR() generator.parameters = ["mass ratio"] times = np.linspace(-0.05, 0.05, 1000) hp, hx = generator.mean({"mass ratio": 1}, times) import matplotlib.pyplot as plt %matplotlib inline plt.plot(hp.data) s...
github_jupyter
# Tutorial Part 10: Exploring Quantum Chemistry with GDB1k Most of the tutorials we've walked you through so far have focused on applications to the drug discovery realm, but DeepChem's tool suite works for molecular design problems generally. In this tutorial, we're going to walk through an example of how to train a ...
github_jupyter
<a href="https://colab.research.google.com/github/Chiebukar/Deep-Learning/blob/main/regression/temperature_forcasting_with_RNN.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Temperature Forcasting with Jena climate dataset ``` from google.colab...
github_jupyter
### PPO, Actor-Critic Style _______________________ &nbsp;&nbsp;**for** iteration=1,2,... do<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**for** actor=1,2,...,N do<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Run policy $\pi_{\theta_{old}}$ in environment for T timesteps<br> &nbsp...
github_jupyter
<h1> Create TensorFlow model </h1> This notebook illustrates: <ol> <li> Creating a model using the high-level Estimator API </ol> ``` # change these to try this notebook out BUCKET = 'qwiklabs-gcp-37b9fafbd24bf385' PROJECT = 'qwiklabs-gcp-37b9fafbd24bf385' REGION = 'us-central1' import os os.environ['BUCKET'] = BUCK...
github_jupyter
## Denoising Autoencoder on MNIST dataset * This notebook will give you a very good understanding abou denoising autoencoders * For more information: visit [here](https://lilianweng.github.io/lil-log/2018/08/12/from-autoencoder-to-beta-vae.html) * The entire notebook is in PyTorch ``` # Importing packages that will be...
github_jupyter
# Cleaning the data to build the prototype for crwa ### This data cleans the original sql output and performs cleaning tasks. Also checking validity of the results against original report found at ### https://www.crwa.org/uploads/1/2/6/7/126781580/crwa_ecoli_web_2017_updated.xlsx ``` import pandas as pd pd.options.di...
github_jupyter
# MATH 4100: Temporal data analysis and applications to stock analysis *Curtis Miller* ## Introduction This is a lecture for [MATH 4100/CS 5160: Introduction to Data Science](http://datasciencecourse.net/), offered at the University of Utah, introducing time series data analysis applied to finance. Advanced mathemat...
github_jupyter