code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
**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 |
# WeatherPy
----
#### Note
* Instructions have been included for each segment. You do not have to follow them exactly, but they are included to help you think through the steps.
```
!pip3 install citipy
# Dependencies and Setup
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import requests
imp... | 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 |
# Import and settings
```
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.path import Path
import matplotlib.patches as patches
from snaptools import manipulate as man
from snaptools import snapio
from snaptools import plot_tools
from snaptools import utils
from scipy.stats import binned_statistic
f... | github_jupyter |
<a href="https://colab.research.google.com/github/Ciiku-Kihara/LOAN-APPROVAL-PROJECT/blob/main/THE_LOAN_APPROVAL_PROJECT.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
## A CASE STUDY OF FACTORS AFFECTING LOAN APPROVAL
## 1. Defining the question
... | 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

_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 |
# HLCA Figure 2
Here we will generate the figures from the HLCA pre-print, figure 2. Figure 2d was generated separately in R, using code from integration benchmarking framework 'scIB'.
### import modules, set paths and parameters:
```
import scanpy as sc
import pandas as pd
import numpy as np
import sys
import os
fr... | 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 |
```
import glob
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
```
# README
This notebook extracts some information about fitting. For each molecule, it creates a CSV file.
It calculates the Euclidean distance and topological distance (number of bonds separating an atom and ... | github_jupyter |
<a href="https://colab.research.google.com/github/Pager07/A-Hackers-AI-Voice-Assistant/blob/master/DataCleansingAndEda.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
#Load Data
```
import pandas as pd
import numpy as np
isMergedDatasetAvailabel =... | 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 pandas as pd
import numpy as np
import math
import keras
import tensorflow as tf
import progressbar
import os
from os import listdir
```
## Print Dependencies
Dependences are fundamental to record the computational environment.
```
%load_ext watermark
# python, ipython, packages, and machine character... | github_jupyter |
## Recreation of Terry's Notebook with NgSpice
In this experiment we are going to recreate Terry's notebook with NgSpice simulation backend.
## Step 1: Set up Python3 and NgSpice
```
%matplotlib inline
import matplotlib.pyplot as plt
# check if ngspice can be found from python
from ctypes.util import find_library
n... | github_jupyter |
```
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
fro... | github_jupyter |
# For Loops (2) - Looping through the items in a sequence
In the last lesson we introduced the concept of a For loop and learnt how we can use them to repeat a section of code. We learnt how to write a For loop that repeats a piece of code a specific number of times using the <code>range()</code> function, and saw th... | 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 |
# 1-5.2 Python Intro
## conditionals, type, and mathematics extended
- conditionals: `elif`
- casting
- **basic math operators**
-----
><font size="5" color="#00A0B2" face="verdana"> <B>Student will be able to</B></font>
- code more than two choices using `elif`
- gather numeric input using type casting ... | 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 |
```
%load_ext autoreload
%autoreload
import numpy as np
import matplotlib.pyplot as plt
import os
import glob
from mirisim.config_parser import SimulatorConfig
from mirisim import MiriSimulation
import tso_img_datalabs_sim
from tso_img_datalabs_sim import wasp103_scene, wasp103_sim_config
from importlib import reload
... | github_jupyter |
<a href="https://colab.research.google.com/github/HartmutD/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Cluster_Feature_Importance.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Clustered Feature Importance
The goal of ... | 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 |
## 1. Adding Student Details
```
import time
import numpy as np
from json import loads, dumps
data = {}
history = {}
reg_no = str(input('Enter your registraion no: '))
name = str(input('Name : '))
mail = str(input('Mail-ID : '))
phone = str(input('Phone No : '))
section = str(input('Section : '))
... | 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 |
# Creating EEG Objects
## Epoch Creation
<a id="intro"></a>
```
from simpl_eeg import eeg_objects
```
<br>
### Module Overview
The `eeg_objects` module contains helper classes for storing and manipulating relevant information regarding epochs to pass to other package functions. It contains two classes. Typically y... | github_jupyter |
<a href="http://cocl.us/pytorch_link_top">
<img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/DL0110EN/notebook_images%20/Pytochtop.png" width="750" alt="IBM Product " />
</a>
<img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/DL0110EN... | github_jupyter |
# Multiscale Basics Tutorial
*By R. Bulanadi, 28/01/20*
***
While Project Multiscale is currently very powerful, it has a slight learning curve to understand the required functions for basic use. This notebook has been written to teach the basics of using Project Multiscale functions, by binarising the Phase channels... | github_jupyter |
## Our Mission ##
Spam detection is one of the major applications of Machine Learning in the interwebs today. Pretty much all of the major email service providers have spam detection systems built in and automatically classify such mail as 'Junk Mail'.
In this mission we will be using the Naive Bayes algorithm to cr... | 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 |
```
import numpy as np
from scipy.optimize import least_squares
#from pandas import Series, DataFrame
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use('Qt5Agg')
%matplotlib qt5
#
# if pade.py is not in the current directory, set this path:
#
#import sys
#sys.path.append('../Python_li... | github_jupyter |
# Project 4: Neural Networks Project
All code was complied and run in Google Colab as Neural models take time to run and the university laptops donot have enough processing power to run the same.
##### All comments and conclusions have been added right below each code block for easier analysis and understanding
<a hr... | 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 |
<a href="https://colab.research.google.com/github/kalz2q/mycolabnotebooks/blob/master/learnelixir.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# メモ
elixir を齧る。かじる。
今のイメージ $\quad$ erlang 上で、erlang は 並行処理のためのシステムで、その erlang 上で理想的な言語を作ろうとしたら、ruby ... | 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 |
This IPython Notebook introduces the use of the `openmc.mgxs` module to calculate multi-group cross sections for an infinite homogeneous medium. In particular, this Notebook introduces the the following features:
* **General equations** for scalar-flux averaged multi-group cross sections
* Creation of multi-group cros... | github_jupyter |
# Bungee Characterization Lab
## PH 211 COCC
### Bruce Emerson 1/20/2021
This notebook is meant to provide tools and discussion to support data analysis and presentation as you generate your lab reports.
[Bungee Characterization (Bungee I)](http://coccweb.cocc.edu/bemerson/PhysicsGlobal/Courses/PH211/PH211Materials/... | 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 |
```
# LINEAR Regression on Precision table
import pandas as pd
from sklearn import linear_model
import numpy as np
import seaborn as sns
sns.set(color_codes=True)
def sk_linearReg_org(data):
data_set = [[value[0], value[1], value[2], value[3]] for value in data]
Y = [value[4] for value in data]
cl... | github_jupyter |
```
from __future__ import print_function
from __future__ import division
FASTPART=False
if FASTPART:
num_frames = 4
else:
num_frames = 16
is_alchemy_used = True
from datetime import datetime
import pandas as pd
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import torc... | 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 |
# Classification and Regression
There are two major types of supervised machine learning problems, called *classification* and *regression*.
In classification, the goal is to predict a *class label*, which is a choice from a predefined list of possibilities. In *Intro_to_Decision_Trees.ipynb* we used the example of cl... | github_jupyter |
# Parameter Management
Once we have chosen an architecture
and set our hyperparameters,
we proceed to the training loop,
where our goal is to find parameter values
that minimize our objective function.
After training, we will need these parameters
in order to make future predictions.
Additionally, we will sometimes ... | github_jupyter |
```
from tensorflow.python.client import device_lib
device_lib.list_local_devices()
import segmentation_models as sm
import tensorflow as tf
from pycocotools.coco import COCO
from pathlib import Path
import numpy as np
from typing import Final
import plotly.express as px
from matplotlib import pyplot as plt
import cv2
... | github_jupyter |
```
import sys
import os
import math, numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from numpy import linalg as LA
import numpy as np
infile = os.listdir('/users/timeifler/Dropbox/cosmolike_store/LSST_emu/cov/')
data = [x[4:29] for x in infile]
data= [i.replace('LSST_Y10','LSST_3x2pt_Y10... | github_jupyter |
<a href="https://colab.research.google.com/github/RenqinSS/Rec/blob/main/algo.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
import random
import os
import numpy as np
import torch
SEED = 45
def seed_everything(seed):
random.seed(seed)
... | 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 |
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W2D1_DeepLearning/W2D1_Outro.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <a href="https://kaggle.com/kernels/welcome?src=https://raw.g... | github_jupyter |
# Suicide Analysis in India
In this notebook we will try to understand what might be the different reasons due to which people committed suicide in India (using the dataset "Suicides in India"). Almost 11,89,068 people committed suicide in 2012 alone, it is quite important to understand why they commit suicide and try... | github_jupyter |
# Tutorial 0a: Setting Up Python For Scientific Computing
In this tutorial, we will set up a scientific Python computing environment using the [Anaconda python distribution by Continuum Analytics](https://www.continuum.io/downloads).
## Why Python?
As is true in human language, there are [hundreds of computer pr... | github_jupyter |
# CNN Image Data Preview & Statistics
### Welcome!
This notebook allows you to preview some of your single-cell image patches to make sure your annotated data are of good quality. You will also get a chance to calculate the statistics for your annotated data which can be useful for data preprocessing, e.g. *class im... | 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 |
```
%%capture
!pip install openmined_psi
import syft as sy
duet = sy.join_duet(loopback=True)
import openmined_psi as psi
class PsiClientDuet:
def __init__(self, duet, timeout_secs=-1):
self.duet = duet
# get the reveal intersection flag and create a client
reveal_intersection_ptr =... | 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 |
# Box Plots
The following illustrates some options for the boxplot in statsmodels. These include `violin_plot` and `bean_plot`.
```
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.api as sm
```
## Bean Plots
The following example is taken from the docstring of `beanplot`.
... | 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 os
os.chdir("C:\\Users\\Pieter-Jan\\Documents\\Work\\Candriam\\nlp\\ESG\\top2Vec\\TopicModelling")
from modules import Top2Vec_custom
import pandas as pd
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
import pickle
import plotly.express as px
%reload_ext autoreload
%autoreload 2
d... | github_jupyter |
```
%matplotlib inline
from matplotlib import style
style.use('fivethirtyeight')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import datetime as dt
```
# Reflect Tables into SQLAlchemy ORM
```
# Python SQL toolkit and Object Relational Mapper
import sqlalchemy
from sqlalchemy.ext.automap imp... | 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 |
<a id='sect0'></a>
## <font color='darkblue'>Preface</font>
雖然我年紀已經不小, 但是追朔 [FP (Functional programming) 的歷史](https://en.wikipedia.org/wiki/Functional_programming#History), 我也只能算年輕:
> The lambda calculus, developed in the 1930s by Alonzo Church, is a formal system of computation built from function application.
<br/>... | 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 |
# SWI - single layer
Test case - strange behaviour output control package
When requesting both budget and head data via the OC package, the solution
differs from when only the head is requested.
This is set via the 'words' parameter in the OC package.
```
%matplotlib inline
import os
import sys
import numpy as np
i... | github_jupyter |
# Bank customers clustering project
This dataset contains data on 5000 customers. The data include customer demographic information (age, income, etc.), the customer's relationship with the bank (mortgage, securities account, etc.), and the customer response to the last personal loan campaign (Personal Loan). Among 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 |
```
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
```
## Read data
Your task is to find parameters $\beta$ of a linear model that approximates the following observations. Each observation is decribed by only one input feature $x_{1}$.
```
# Read data for the file
data = pd... | github_jupyter |
###### Content under Creative Commons Attribution license CC-BY 4.0, code under MIT license (c)2014 L.A. Barba, G.F. Forsyth, C.D. Cooper.
# Spreading out
Welcome back! This is the third lesson of the course [Module 4](https://github.com/numerical-mooc/numerical-mooc/tree/master/lessons/04_spreadout), _Spreading out:... | 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 |
```
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
%matplotlib inline
from glob import glob
all_q = {}
x_dirs = glob('x/*/')
x_dirs[0].split('/')
'1qtable'.split('1')
for x_dir in x_dirs:
chain_length = x_dir.split... | github_jupyter |
```
# import package
# installed via pip
from emtracks.particle import * # main solver object
from emtracks.conversions import one_gev_c2_to_kg # conversion for q factor (transverse momentum estimate)
from emtracks.tools import *#InitConds # initial conditions namedtuple
from emtracks.mapinterp import get_df_interp_fun... | 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 |
## Omega and Xi
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` and can relate tho... | github_jupyter |
# Chapter 3-2 Multiple Linear Regression
Concepts and data from "An Introduction to Statistical Learning, with applications in R" (Springer, 2013) with permission from the authors: G. James, D. Witten, T. Hastie and R. Tibshirani " available at [www.StatLearning.com](http://www.StatLearning.com).
For Tables referen... | github_jupyter |
```
import numpy as np
jpt_peptides_file_name = "jpt_sequences.txt"
jpt_mgf_file_name = "jpt_predicted_isoforms_nofixprop.mgf"
uniprot_proteins_file_name = "uniprot_histones.txt"
uniprot_mgf_file_name = "uniprot_predicted_isoforms_nofixprop.mgf"
msp_predictions_file_name = "M_Human_Histones_output_predictions.msp"
pr... | github_jupyter |
## Stack - Bootcamp de Data Science
### Machine Learning.
```
import pandas as pd
import datetime
import glob
from minio import Minio
import numpy as np
import matplotlib.pyplot as plt
client = Minio(
"localhost:9000",
access_key="minioadmin",
secret_key="minioadmin",
secure=False
... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.