code
stringlengths
2.5k
150k
kind
stringclasses
1 value
<a href="https://colab.research.google.com/github/healthonrails/annolid/blob/main/docs/tutorials/Train_networks_tutorial_v1.0.1.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Annolid (A segmenation based on mutiple animal tracking package) In t...
github_jupyter
### Model Selection In order to select the best model for our data, I am going to look at scores for a variety of scikit-learn models and compare them using visual tools from Yellowbrick. ### Imports ``` %matplotlib inline import warnings warnings.filterwarnings('ignore') import os import pandas as pd from sklearn.m...
github_jupyter
# Antarctic Circumnavigation Expedition Cruise Track data processing ## GLONASS and Trimble GPS data Follow the steps as described here: http://epic.awi.de/48174/ Import relevant packages ``` import pandas as pd import csv import MySQLdb import datetime import math import numpy as np ``` ### STEP 1 - Extract data ...
github_jupyter
# EuroSciPy 2018: NumPy tutorial (https://github.com/gertingold/euroscipy-numpy-tutorial) ## Let's do some slicing ``` mylist = list(range(10)) print(mylist) ``` Use slicing to produce the following outputs: [2, 3, 4, 5] [0, 1, 2, 3, 4] [6, 7, 8, 9] [0, 2, 4, 6, 8] [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] [7, 5, 3] ## ...
github_jupyter
``` '''Check that the simulated kappa_gmf values are properly simulated, and also check them as a function of Z''' %matplotlib inline import matplotlib.pyplot as plt import numpy as np import os import h5py import matplotlib.lines as mlines from fancy import Uhecr from fancy.interfaces.stan import uv_to_coord from fan...
github_jupyter
#Grae prediction using Parallel Random Forest Grading is necessary tool for measure outcome of the sudying process. Unsuccessful lerning process may depend on many factors such as student attenction, teacher and background knowledge. In many academic instituetions, the prerequisite subjects are required before re...
github_jupyter
## 8.5 Optimization of Basic Blocks ### 8.5.1 > Construct the DAG for the basic block > ``` d = b * c e = a + b b = b * c a = e - d ``` ``` +--+--+ | - | a +-+++-+ | | +---+ +---+ | | +--v--+ +--v--+ e | + | | * | d,b +-+++-+...
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
# Using `matplotlib` to display inline images In this notebook we will explore using `matplotlib` to display images in our notebooks, and work towards developing a reusable function to display 2D,3D, color, and label overlays for SimpleITK images. We will also look at the subtleties of working with image filters that...
github_jupyter
## Logistic Regression ``` import numpy as np import pandas as pd from sklearn.model_selection import train_test_split,KFold from sklearn.utils import shuffle from sklearn.metrics import confusion_matrix,accuracy_score,precision_score,\ recall_score,roc_curve,auc import expectation_reflection as ER from sklearn.line...
github_jupyter
![Astrofisica Computacional](../logo.PNG) --- ## 01. Interpolación de Funciones Eduard Larrañaga (ealarranaga@unal.edu.co) --- ## Interpolación ### Resumen En este cuaderno se presentan algunas de las técnicas de interpolación de una función. --- ## Interpolación Los datos astrofísicos (experimentales y sint...
github_jupyter
# Introduction # Most of the techniques we've seen in this course have been for numerical features. The technique we'll look at in this lesson, *target encoding*, is instead meant for categorical features. It's a method of encoding categories as numbers, like one-hot or label encoding, with the difference that it also...
github_jupyter
## Deploy an ONNX model to an IoT Edge device using ONNX Runtime and the Azure Machine Learning ![End-to-end pipeline with ONNX Runtime](https://github.com/manashgoswami/byoc/raw/master/ONNXRuntime-AML.png) ``` !python -m pip install --upgrade pip !pip install azureml-core azureml-contrib-iot azure-mgmt-containerregi...
github_jupyter
``` % matplotlib inline import json, re import fiona from shapely.geometry import MultiPolygon, shape import pandas as pd import geopandas as gp import numpy as np import matplotlib import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib.collections import PatchCollection from matplotlib.colors im...
github_jupyter
# About this kernel + efficientnet_b3 + CurricularFace + Mish() activation + Ranger (RAdam + Lookahead) optimizer + margin = 0.9 ## Imports ``` import sys sys.path.append('../input/shopee-competition-utils') sys.path.insert(0,'../input/pytorch-image-models') import numpy as np import pandas as pd import torch ...
github_jupyter
``` import pandas as pd import numpy as np import datetime import matplotlib.pyplot as plt import math import seaborn as sns import multiprocessing from multiprocessing import Process from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import MinMaxScaler from sklearn.model_selection import t...
github_jupyter
# North and South Chickamauga Creek USGS Stations Streamflow Data for HSPF Model ## Shuvashish Roy ### *We will use hydrofunctions package for flow data retrieval* ``` pip show hydrofunctions import hydrofunctions as hf import pandas as pd %matplotlib inline import hydrofunctions as hf import pandas as pd %matplotli...
github_jupyter
<center> <img src="https://gitlab.com/ibm/skills-network/courses/placeholder101/-/raw/master/labs/module%201/images/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # **Space X Falcon 9 First Stage Landing Prediction** ## Assignment: Machine Learning Prediction Estimated time needed: **60**...
github_jupyter
``` # While in argo environment: Import necessary packages for this notebook import numpy as np from matplotlib import pyplot as plt import xarray as xr import pandas as pd from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() %matplotlib inline import glob ``` !python -m pip in...
github_jupyter
``` %matplotlib inline %run notebook_setup ndim = 15 import time import emcee import numpy as np import pymc3 as pm from pymc3.step_methods.hmc import quadpotential as quad np.random.seed(41) with pm.Model() as model: pm.Normal("x", shape=ndim) potential = quad.QuadPotentialDiag(np.ones(ndim)) step_kwa...
github_jupyter
<h1 id="i1"> Data 512 - A6 : Predicting Earthquakes : Final Project</h1> Gautam Moogimane <br> University of Washington - Fall 2018 <h2 id="i1">I. Introduction </h2> Having stayed in Japan for a long time, I've been accustomed to getting up at odd hours, with everything shaking around me. Tremors and earthqua...
github_jupyter
# Pre-Calculus Notebook ``` # Begin with some useful imports import numpy as np import pylab from fractions import Fraction from IPython.display import display, Math from sympy import init_printing, N, pi, sqrt, symbols, Symbol from sympy.abc import x, y, theta, phi init_printing(use_latex='mathjax') # do this to all...
github_jupyter
``` #importing the packages import pandas as pd import numpy as np import random import matplotlib.pyplot as plt import seaborn as sns sns.set() import joblib # for saving algorithm and preprocessing objects from sklearn.linear_model import LinearRegression # uploading the dataset df = pd.read_csv('pollution_us_2000_...
github_jupyter
# Modeling and Simulation in Python Chapter 5: Design Copyright 2017 Allen Downey License: [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0) ``` # If you want the figures to appear in the notebook, # and you want to interact with them, use # %matplotlib notebook # If yo...
github_jupyter
## Dependencies ``` import os import cv2 import shutil 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, coh...
github_jupyter
# Covid-19 Prediction from Lung CT This notebook utilizes a trained **classifier** to recognize **Covid-19** positive patients from their **CT lungs** scans in order to support the physician’s decision process with a quantitative approach. ``` from esmlib import * ``` ## Select an exam folder With the following cod...
github_jupyter
# Monte Carlo Simulations with Python (Part 1) [Patrick Hanbury](https://towardsdatascience.com/monte-carlo-simulations-with-python-part-1-f5627b7d60b0) - Notebook author: Israel Oliveira [\[e-mail\]](mailto:'Israel%20Oliveira%20'<prof.israel@gmail.com>) ``` %load_ext watermark import numpy as np import math import r...
github_jupyter
``` import sys; sys.path.append('../rrr') from multilayer_perceptron import * from figure_grid import * from local_linear_explanation import * from toy_colors import generate_dataset, imgshape, ignore_rule1, ignore_rule2, rule1_score, rule2_score import lime import lime.lime_tabular ``` # Toy Color Dataset This is a ...
github_jupyter
``` import os import re import torch import pickle import pandas as pd import numpy as np from tqdm.auto import tqdm tqdm.pandas() ``` # 1. Pre-processing ### Create a combined dataframe > This creates a dataframe containing the image IDs & labels for both original images provided by the Bristol Myers Squibb pharmac...
github_jupyter
``` import functools import pathlib import numpy as np import matplotlib.pyplot as plt import shapely.geometry import skimage.draw import tensorflow as tf import pydicom import pymedphys import pymedphys._dicom.structure as dcm_struct # Put all of the DICOM data here, file structure doesn't matter: data_path_root ...
github_jupyter
``` import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from keras.datasets import mnist (x_train, y_train), _ = mnist.load_data() x_train = x_train / 255.0 x_train = np.expand_dims(x_train, axis=3) print(x_train.shape) print(y_train.shape) num_classes = 10 plt.imshow(np.squeeze(x_train[10])) ...
github_jupyter
## Accessing High Resolution Electricity Access (HREA) data with the Planetary Computer STAC API The HREA project aims to provide open access to new indicators of electricity access and reliability across the world. Leveraging VIIRS satellite imagery with computational methods, these high-resolution data provide new t...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = "0" import numpy as np from matplotlib import pyplot as plt import seaborn as sns import pandas as pd from tqdm.auto import tqdm import torch from torch import nn import gin import pickle import io from sparse_causal_model_learner_rl.trainable.gumbel_switch import With...
github_jupyter
# [ATM 623: Climate Modeling](../index.ipynb) [Brian E. J. Rose](http://www.atmos.albany.edu/facstaff/brose/index.html), University at Albany # Lecture 16: Modeling the seasonal cycle of surface temperature ### About these notes: This document uses the interactive [`Jupyter notebook`](https://jupyter.org) format. T...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import sklearn as sk from sklearn import linear_model from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error from sklearn.preprocessing import MinMaxScaler # Набор данных взят с https://www.kaggle.co...
github_jupyter
<h1>2b. Machine Learning using tf.estimator </h1> In this notebook, we will create a machine learning model using tf.estimator and evaluate its performance. The dataset is rather small (7700 samples), so we can do it all in-memory. We will also simply pass the raw data in as-is. ``` import tensorflow as tf import p...
github_jupyter
``` from sklearn.datasets import make_blobs X, y = make_blobs(n_samples=50, centers=2, cluster_std=0.5, random_state=4) y = 2 * y - 1 plt.scatter(X[y == -1, 0], X[y == -1, 1], marker='o', label="-1 class") plt.scatter(X[y == +1, 0], X[y == +1, 1], marker='x', label="+1 class") plt.xlabel("x1") plt.ylabel("x2") plt.leg...
github_jupyter
### Set up google colab and unzip train data ``` # Set up google drive in google colab #save this change to master from google.colab import drive drive.mount('/content/drive') # Unzip training data from drive !unzip -q 'drive/My Drive/VOCdevkit.zip' ``` ### Import Libraries ``` import random import os import math i...
github_jupyter
# LeetCode #804. Unique Morse Code Words ## Question https://leetcode.com/problems/unique-morse-code-words/ International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on. Fo...
github_jupyter
*아래 링크를 통해 이 노트북을 주피터 노트북 뷰어(nbviewer.jupyter.org)로 보거나 구글 코랩(colab.research.google.com)에서 실행할 수 있습니다.* <table class="tfo-notebook-buttons" align="left"> <td> <a target="_blank" href="https://nbviewer.org/github/rickiepark/nlp-with-pytorch/blob/master/chapter_1/PyTorch_Basics.ipynb"><img src="https://jupyter.org...
github_jupyter
#1. Install Dependencies First install the libraries needed to execute recipes, this only needs to be done once, then click play. ``` !pip install git+https://github.com/google/starthinker ``` #2. Get Cloud Project ID To run this recipe [requires a Google Cloud Project](https://github.com/google/starthinker/blob/mast...
github_jupyter
``` # Exploratory Data Analysis and Plotting Libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # Scikit-Learn Models from sklearn.linear_model import LogisticRegression from sklearn.neighbors import KNeighborsClassifier from sklearn.ensemble import RandomForestClass...
github_jupyter
``` import pymongo uri = "mongodb://user1:MongoPassWd1@localhost:27017/" client = pymongo.MongoClient(uri, 27017) db = client["DjangoServer"] col = db["dangdangBook"] col.estimated_document_count() from bson import json_util import json from bson import ObjectId class JSONEncoder(json.JSONEncoder): """处理ObjectId...
github_jupyter
# Sklearn compatible Grid Search for classification Grid search is an in-processing technique that can be used for fair classification or fair regression. For classification it reduces fair classification to a sequence of cost-sensitive classification problems, returning the deterministic classifier with the lowest em...
github_jupyter
# "Reverse mode autodiff" > "Understand how machine learning frameworks implement autodiff" - toc:true - branch: master - badges: true - comments: true - author: Saibaba Telukunta - categories: [autodiff, autograd, gradient, partial-derivative, chain-rule] Introduction -- Gradient descent (GD) is the main workhorse ...
github_jupyter
``` import pandas as pd import numpy as np def load_datasets(): file = '../Data-files/1352S_101F.xlsx' sheets = ['整数-101F', 'top5F', 'top3F', '3F'] tables = {name: pd.read_excel(file, sheet_name=name) for name in sheets} for i in tables.values(): i.index += 1 return tables def to_ot...
github_jupyter
# TicTacToe ### Main File NOTE:Add in Sections as they are completed ### Completed Sections 1. TODO: 2. TODO: 3. TODO: 4. TODO: 5. Complete 6. TODO: 7. TODO: 8. TODO: ## Sections 1. Selection of the first player. (e.g. Would you like to play first?) 2. Assignment of "O" or "X" for a user. (e.g. Please choose 'O...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # 06. Distributed CNTK using custom docker images In this tutorial, you will train a CNTK model on the [MNIST](http://yann.lecun.com/exdb/mnist/) dataset using a custom docker image and distributed training. ## Prerequisites * ...
github_jupyter
``` from time import time from importlib import reload import pandas as pd import sklearn import numpy as np import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression, ElasticNet, LogisticRegression from sklearn.ensemble import ExtraTreesClassifier, ExtraTreesRegressor, GradientBoostingClassifi...
github_jupyter
<a href="https://colab.research.google.com/github/skojaku/cidre/blob/second-edit/examples/example.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # About this notebook In this notebook, we apply CIDRE to a network with communities and demonstrate h...
github_jupyter
# Fine-Tuning a BERT Model and Create a Text Classifier In the previous section, we've already performed the Feature Engineering to create BERT embeddings from the `reviews_body` text using the pre-trained BERT model, and split the dataset into train, validation and test files. To optimize for Tensorflow training, we ...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline ``` ### Loading Data ``` data = pd.read_csv('Coffee.csv') ``` ### Finding out the any missing values across columns **We can see there are no missing values** ``` pd.isnull(data).sum() ``` ### Looking at some part of dat...
github_jupyter
``` import pandas as pd import numpy as np from tqdm import tqdm import seaborn as sns import matplotlib.pyplot as plt import re from nltk.corpus import stopwords stop = list(set(stopwords.words('english'))) f_train = open('../data/train_14k_split_conll.txt','r',encoding='utf8') line_train = f_train.readlines() f_val...
github_jupyter
``` import pyspark import pandas as pd import csv from pyspark.ml.feature import ChiSqSelector from pyspark.ml.linalg import Vectors from pyspark import SparkContext ,SparkConf from pyspark.ml import Pipeline from pyspark.ml.feature import OneHotEncoder, StringIndexer from pyspark import SQLContext as sql from pyspark....
github_jupyter
# Exploratory Data Analysis ## Loading Imports and Data ``` !python -m spacy download en_core_web_lg !pip install squarify # Base import pandas as pd import numpy as np from collections import Counter # Plotting import squarify import matplotlib.pyplot as plt import seaborn as sns # NLP Libraries import spacy from ...
github_jupyter
# 2-22: Intro to scikit-learn <img src="https://www.cityofberkeley.info/uploadedImages/Public_Works/Level_3_-_Transportation/DSC_0637.JPG" style="width: 500px; height: 275px;" /> --- ** Regression** is useful for predicting a value that varies on a continuous scale from a bunch of features. This lab will introduce th...
github_jupyter
# Author: Faique Ali ## Task 01 : Prediction Using Supervised ML <p> Using Linear Regression, predict the percentage of an student based on his no. of study hours. </p> # Imports ``` import pandas as pd from pandas import DataFrame import matplotlib.pyplot as plt from sklearn.model_selection import train_test_...
github_jupyter
# Analysis of SHEMAT-Suite models The created geological models with gempy were exported as SHEMAT-Suite input files. SHEMAT-Suite (https://git.rwth-aachen.de/SHEMAT-Suite/SHEMAT-Suite-open) [1] is a code for solving coupled heat transport in porous media. It is written in fortran and uses a finite differences scheme ...
github_jupyter
**Chapter 19 – Training and Deploying TensorFlow Models at Scale** _This notebook contains all the sample code in chapter 19._ <table align="left"> <td> <a target="_blank" href="https://colab.research.google.com/github/ageron/handson-ml2/blob/master/19_training_and_deploying_at_scale.ipynb"><img src="https://ww...
github_jupyter
Lambda School Data Science *Unit 2, Sprint 3, Module 4* --- # Model Interpretation - Visualize and interpret **partial dependence plots** - Explain individual predictions with **shapley value plots** ### Setup Run the code cell below. You can work locally (follow the [local setup instructions](https://lambdascho...
github_jupyter
<div align="center"> <font size="5">__cta-lstchain: Notebook for training and storage Random Forests for LST1 data analysis__</font> <font size="4"> To run this notebook you will need the last version of cta-lstchain: git clone https://github.com/cta-observatory/cta-lstchain <br> <br> **If you have ctapipe alread...
github_jupyter
# Napa County Model Build the model for Napa County California. The goal of the model will be to predict the total burn area of wildfires in Napa County for a given month ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import statsmodels.api as sm from catboost import...
github_jupyter
# Thomas Robbins ### GEOS 505 Final Project Nov. 15 submission #### In conjunction with the abstract that was previously submitted for this project, the work below is the submission requirement for Nov. 15th, 2018. ##### Below are snippets of code that represent the data chosen for this project, along with brief exp...
github_jupyter
<a href="https://colab.research.google.com/github/ayan59dutta/MLCC-Exercises/blob/master/Preliminaries/creating_and_manipulating_tensors.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #### Copyright 2017 Google LLC. ``` # Licensed under the Apache...
github_jupyter
### Imports and Helper Functions ``` import numpy as np import dask_xgboost as dxgb_gpu import dask import dask_cudf from dask.delayed import delayed from dask.distributed import Client, wait import xgboost as xgb import cudf from cudf.dataframe import DataFrame from collections import OrderedDict import gc from glob ...
github_jupyter
## Import modules ``` import numpy as np import matplotlib.pyplot as plt import os import time from sklearn.linear_model import SGDRegressor, LinearRegression from sklearn.preprocessing import StandardScaler from sklearn.pipeline import make_pipeline from sklearn.metrics import mean_squared_error ``` ## Utils ``` d...
github_jupyter
``` import pandas as pd import numpy as np %matplotlib inline if 'bigDataFrame' in globals(): print("Exist, do nothing!") else: print("Read data.") bigDataFrame = pd.read_pickle("../output/bigDataFrame.pkl") bigDataFrame.rename(columns={"PM2.5": "PM25"}, inplace=True) bigDataFrame.head() pollutedPlaces ...
github_jupyter
# Longest Palindromic Subsequence In this notebook, you'll be tasked with finding the length of the *Longest Palindromic Subsequence* (LPS) given a string of characters. As an example: * With an input string, `ABBDBCACB` * The LPS is `BCACB`, which has `length = 5` In this notebook, we'll focus on finding an optimal...
github_jupyter
# Pool-based Active Learning - Getting Started The main purpose of this tutorial is to ease the implementation of our library `scikit-activeml` to new users. `scikit-activeml` is a library that executes the most important query strategies. It is built upon the well-known machine learning frame-work `scikit-learn`, whi...
github_jupyter
# Centerpartiets budgetmotion 2022 https://www.riksdagen.se/sv/dokument-lagar/dokument/motion/centerpartiets-budgetmotion-2022_H9024121 ``` import pandas as pd import requests pd.options.mode.chained_assignment = None multiplier = 1_000_000 docs = [ {'utgiftsområde': 1, 'dok_id': 'H9024141'}, {'utgiftsområde...
github_jupyter
## Plotting of profile results ``` #!/usr/bin/env python # -*- coding: utf-8 -*- # common import os import os.path as op # pip import numpy as np import pandas as pd import math import xarray as xr import matplotlib.pyplot as plt from matplotlib import gridspec # DEV: override installed teslakit import sys sys.path...
github_jupyter
# Dropout regularization with gluon ``` import mxnet as mx import numpy as np from mxnet import gluon from tqdm import tqdm_notebook as tqdm ``` ## Context ``` ctx = mx.cpu() ``` ## The MNIST Dataset ``` batch_size = 64 num_inputs = 784 num_outputs = 10 def transform(data, label): return data.astype(np.float32...
github_jupyter
# Update rules ``` import numpy as np import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as p3 import matplotlib.animation as animation from IPython.display import HTML from matplotlib import cm from matplotlib.colors import LogNorm def sgd(f, df, x0, y0, lr, steps): x = np.zeros(steps + 1) y ...
github_jupyter
### Interest Rate Regression Model using Linear Regression+RandomCV - Five models were created. Three Interest Rate Regression Models and two Loan Default Classification Models - This notebook is a deep dive into the Linear Regression Model created to predict Loan Interest Rates. - We will begin by exploring the top f...
github_jupyter
#### MTA Project mvp ###### Project Goal - Generate data to facilitate micro-targeted advertising based on time of day and demographics. - I am focusing on the Canal St. station with one month of data, but the methodology and code can be easily be applied to other stations and time frames. ###### Milestone Reache...
github_jupyter
## Deliverable 3. Create a Travel Itinerary Map. ``` # Dependencies and Setup import pandas as pd import requests import gmaps # Import API key import sys sys.path.append('../') from config import g_key # Configure gmaps gmaps.configure(api_key=g_key) # 1. Read the WeatherPy_vacation.csv into a DataFrame. vacation_d...
github_jupyter
# Using Biopython's PDB Header parser to get missing residues Previously this worked out and had to be run at that time with a development version of Biopython that I got working [here](https://github.com/fomightez/BernBiopython). Now current Bioython has the essential functionality about missing residues in structur...
github_jupyter
# Software Carpentry # Welcome to Binder This is where will do all our Python, Shell and Git live coding. ## Jupyter Lab Let's quickly familiarise ourselves with the enironment ... - the overal environment (ie your entire browser tab) is called: *Jupyter Lab* it contains menus, tabs, toolbars and a file b...
github_jupyter
# Sorting Objects in Instance Catalogs _Bryce Kalmbach_ This notebook provides a series of commands that take a Twinkles Phosim Instance Catalog and creates different pandas dataframes for different types of objects in the catalog. It first separates the full sets of objects in the Instance Catalogs before picking ou...
github_jupyter
### CS/GTO: step 1 and 2 ``` show_plots=False import numpy as np from scipy.linalg import eig, eigh, eigvals, eigvalsh from scipy.optimize import minimize import matplotlib import matplotlib.pyplot as plt matplotlib.use('Qt5Agg') %matplotlib qt5 import pandas as pd # # extend path by location of the dvr package # imp...
github_jupyter
``` from bs4 import BeautifulSoup from splinter import Browser from pprint import pprint import pymongo import pandas as pd import requests !which chromedriver executable_path = {'executable_path': 'chromedriver'} browser = Browser("chrome", **executable_path) url = ('https://mars.nasa.gov/news/') browser.visit(url) #...
github_jupyter
# Cloud-based machine learning || 云端机器学习 Thus far, we have looked at building and fitting ML models “locally.” True, the notebooks have been located in the cloud themselves, but the models with all of their predictive and classification power are stuck in those notebooks. To use these models, you would have to load d...
github_jupyter
# Mumbai House Price Prediction - Supervised Machine Learning-Regression Problem ## Data Preprocessing # The main goal of this project is to Predict the price of the houses in Mumbai using their features. # Import Libraries ``` # importing necessary libraries import pandas as pd import matplotlib.pyplot as plt %ma...
github_jupyter
``` import os import glob import math import time from joblib import Parallel, delayed import pandas as pd import numpy as np import scipy as sc from sklearn.model_selection import KFold import lightgbm as lgb import warnings import matplotlib.pyplot as plt import matplotlib from sklearn.model_selection import train_te...
github_jupyter
``` from scipy.stats import ranksums, sem import numpy as np from statannot import add_stat_annotation import copy import os import matplotlib.pyplot as plt import matplotlib save_dir = os.path.join("/analysis/fabiane/documents/publications/patch_individual_filter_layers/MIA_revision") plt.style.use('ggplot') matplotli...
github_jupyter
``` import forecasting as fc import pandas as pd import numpy as np import warnings warnings.simplefilter('ignore') revenues = pd.read_csv('Final Tables by Tax Source/final_data_revenue.csv') revenues['Date'] = pd.to_datetime(revenues['Date']) revenues = revenues.iloc[:, 1:] ``` 1. Create forecasts DataFrame, contain...
github_jupyter
``` # Import dependencies pandas, # requests, gmaps, census, and finally config's census_key and google_key # Declare a variable "c" and set it to the census with census_key. # https://github.com/datamade/census # We're going to use the default year 2016, however feel free to use another year. # Run a censu...
github_jupyter
# Goals ### Train a classifier using resnet18 on natural-images dataset ### Understand what lies inside resnet18 network # What is resnet ## Readings on resnet 1) Points from https://towardsdatascience.com/an-overview-of-resnet-and-its-variants-5281e2f56035 - The core idea of ResNet is introducing a so-call...
github_jupyter
# Speech Identity Inference Let's check if the pretrained model can really identify speakers. ``` import os import numpy as np import pandas as pd from sklearn import metrics from tqdm.notebook import tqdm from IPython.display import Audio from matplotlib import pyplot as plt %matplotlib inline import tensorflow as...
github_jupyter
``` import numpy as np import cs_vqe as c import ast import os from openfermion import qubit_operator_sparse import conversion_scripts as conv_scr import scipy as sp from openfermion import qubit_operator_sparse import conversion_scripts as conv_scr from openfermion.ops import QubitOperator # with open("hamiltonians.t...
github_jupyter
# Python for data analysis For those who are new to using Python for scientific work, we first provide a short introduction to Python and the most useful packages for data analysis. ## Python Disclaimer: We can only cover some of the basics here. If you are completely new to Python, we recommend to take an introductor...
github_jupyter
``` %matplotlib inline import numpy as np import matplotlib.pylab as plt import scipy import scipy.stats import scipy.integrate ``` # Thème 3 : Analyse Bayésienne ## Jeu du pile ou face On souhaite estimer, à partir d'un série de N mesures au jeu de pile ou face, la probabilité $p$ d'obtenir pile. Pour cela, dans le...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import cv2 import pandas as pd import matplotlib.image as mpimg import pylab as pl %matplotlib inline image = cv2.imread('train_images/0a4e1a29ffff.png') # 000c1434d8d7 0a4e1a29ffff 7b87b0015282 #imgplot = plt.imshow(image) imgplot = plt.imshow(cv2.cvtColor(image...
github_jupyter
# Capstone Project: Create a Customer Segmentation Report for Arvato Financial Services In this project, you will analyze demographics data for customers of a mail-order sales company in Germany, comparing it against demographics information for the general population. You'll use unsupervised learning techniques to pe...
github_jupyter
# Classifying Fashion-MNIST Now it's your turn to build and train a neural network. You'll be using the [Fashion-MNIST dataset](https://github.com/zalandoresearch/fashion-mnist), a drop-in replacement for the MNIST dataset. MNIST is actually quite trivial with neural networks where you can easily achieve better than 9...
github_jupyter
``` # import models import matplotlib.pyplot as plt import numpy as np import xlrd from sklearn.preprocessing import MinMaxScaler from sklearn.svm import SVC from sklearn.model_selection import StratifiedKFold from sklearn.model_selection import GridSearchCV from sklearn.metrics import roc_curve, auc import itertools ...
github_jupyter
Lambda School Data Science *Unit 2, Sprint 2, Module 3* --- <p style="padding: 10px; border: 2px solid red;"> <b>Before you start:</b> Today is the day you should submit the dataset for your Unit 2 Build Week project. You can review the guidelines and make your submission in the Build Week course for your cohort ...
github_jupyter
> **Note:** In most sessions you will be solving exercises posed in a Jupyter notebook that looks like this one. Because you are cloning a Github repository that only we can push to, you should **NEVER EDIT** any of the files you pull from Github. Instead, what you should do, is either make a new notebook and write you...
github_jupyter
# MASH analysis pipeline with data-driven prior matrices This notebook is a pipeline written in SoS to run `flashr + mashr` for multivariate analysis described in Urbut et al (2019). This pipeline was last applied to analyze GTEx V8 eQTL data, although it can be used as is to perform similar multivariate analysis for ...
github_jupyter
# Visualisation in Python - Matplotlib Here is the sales dataset for an online retailer. The data is collected over a period of three years: 2012 to 2015. It contains the information of sales made by the company. The products captured belong to three categories: Furniture Office Supplies Technology Also, the comp...
github_jupyter