code
stringlengths
2.5k
150k
kind
stringclasses
1 value
# Lightweight python components Lightweight python components do not require you to build a new container image for every code change. They're intended to use for fast iteration in notebook environment. **Building a lightweight python component** To build a component just define a stand-alone python function and then...
github_jupyter
# Predicting Student Admissions with Neural Networks In this notebook, we predict student admissions to graduate school at UCLA based on three pieces of data: - GRE Scores (Test) - GPA Scores (Grades) - Class rank (1-4) The dataset originally came from here: http://www.ats.ucla.edu/ ## Loading the data To load the da...
github_jupyter
``` import tensorflow as tf from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.preprocessing import image from tensorflow.keras.applications import MobileNetV2 from tensorflow.keras.layers import AveragePooling2D from tensorflow.keras.layers import Dropout from tensorflow.keras.la...
github_jupyter
``` import matplotlib.pyplot as plt from matplotlib import cm, colors, rcParams import numpy as np import bayesmark.constants as cc from bayesmark.path_util import abspath from bayesmark.serialize import XRSerializer from bayesmark.constants import ITER, METHOD, TEST_CASE, OBJECTIVE, VISIBLE_TO_OPT # User settings, m...
github_jupyter
``` import sys # sys.path.append('GVGAI_GYM') import gym import gym_gvgai import numpy as np import random from IPython.display import clear_output from collections import deque import progressbar import tensorflow as tf from tensorflow import keras from tensorflow.keras import Model, Sequential from tensorflow.k...
github_jupyter
``` from sklearn.neighbors import NearestNeighbors import numpy as np from matplotlib import pyplot as plt #import corner import urllib import os import sys #import GCRCatalogsF from astropy.io import fits #from demo_funcs_local import * from sklearn.model_selection import train_test_split import pandas as pd from astr...
github_jupyter
``` import pandas as pd root = "C:\\Users\\user\\SadafPythonCode\\MLHackathon\\ML-for-Good-Hackathon\\Data\\" df = pd.read_csv(root + 'CrisisLogger\\crisislogger.csv') a = df.iloc[28,1] a import spacy nlp = spacy.load('en_core_web_sm',disable=['ner','textcat']) # function for rule 2 def rule2(text): doc = nlp...
github_jupyter
# Elementare Datentypen *Erinnerung:* Beim Deklarieren einer Variable muss man deren Datentyp angeben oder er muss eindeutig erkennbar sein. Die beiden folgenden Anweisungen erzeugen beide eine Variable vom Typ `int`: var a int b := 42 Bisher haben wir nur einen Datentyp benutzt: `int`. Dieser Typ steht für ...
github_jupyter
# CPO Datascience This program is intended for use by the Portland State University Campus Planning Office (CPO). ``` #Import required packages import pandas as pd import statsmodels.api as sm import statsmodels.formula.api as smf import numpy as np import datetime import seaborn as sns import matplotlib.pyplot as pl...
github_jupyter
# Trabalhando com o Jupyter Ferramenta que permite criação de código, visualização de resultados e documentação no mesmo documento (.ipynb) **Modo de comando:** `esc` para ativar, o cursor fica inativo **Modo de edição:** `enter` para ativar, modo de inserção ### Atalhos do teclado (MUITO úteis) Para usar os atalhos...
github_jupyter
# Uniview module for LIGO event GW170817 *Aaron Geller, 2018* ### Imports and function definitions ``` #This directory contains all the data needed for the module. It should be in the same directory as the notebook dataFolder = "data" import sys, os, shutil, errno, string, urllib sys.path.append(( os.path.abspath...
github_jupyter
# Experiment Analysis In this notebook we will evaluate the results form the experiments executed. For each experiment, one parameter is changed and all others were kept constant as to determine the effect of one variable. **The goals of this analysis are:** 1. Determine the relationship of the number of parameters i...
github_jupyter
``` import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.model_selection import GridSearchCV, RandomizedSearchCV from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score from s...
github_jupyter
# Hyper-parameter tuning **Learning Objectives** 1. Learn how to use `cloudml-hypertune` to report the results for Cloud hyperparameter tuning trial runs 2. Learn how to configure the `.yaml` file for submitting a Cloud hyperparameter tuning job 3. Submit a hyperparameter tuning job to Cloud AI Platform ## Introducti...
github_jupyter
``` import pandas as pd import os import geopy as geo import numpy as np from folium.plugins import FastMarkerCluster import folium from geopy.geocoders import Nominatim import matplotlib.pyplot as plt %matplotlib inline ``` ## Importando a base e gerando um sample ``` os.getcwd() df = pd.read_csv('/home/rsa/Documen...
github_jupyter
# Layers and Blocks :label:`sec_model_construction` When we first introduced neural networks, we focused on linear models with a single output. Here, the entire model consists of just a single neuron. Note that a single neuron (i) takes some set of inputs; (ii) generates a corresponding scalar output; and (iii) has a ...
github_jupyter
**Note.** *The following notebook contains code in addition to text and figures. By default, the code has been hidden. You can click the icon that looks like an eye in the toolbar above to show the code. To run the code, click the cell menu, then "run all".* ``` # Import packages, set preferences, etc. %matplotlib inl...
github_jupyter
# Project 2: Digit Recognition ## Statistical Machine Learning (COMP90051), Semester 2, 2017 *Copyright the University of Melbourne, 2017* ### Submitted by: Yitong Chen ### Student number: 879326 ### Kaggle-in-class username: *YitongChen* In this project, you will be applying machine learning for recognising digit...
github_jupyter
# Machine Learning Engineer Nanodegree ## Supervised Learning ## Project 2: Building a Student Intervention System Welcome to the second project of the Machine Learning Engineer Nanodegree! In this notebook, some template code has already been provided for you, and it will be your job to implement the additional funct...
github_jupyter
<a href="https://colab.research.google.com/github/JoanesMiranda/Machine-learning/blob/master/Autoenconder.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ### Importando as bibliotecas necessárias ``` import numpy as np import matplotlib.pyplot as p...
github_jupyter
## Peer-graded Assignment: Segmenting and Clustering Neighborhoods in Toronto # Part 3 ``` import pandas as pd import numpy as np import json !conda install -c conda-forge geopy --yes from geopy.geocoders import Nominatim import requests from pandas.io.json import json_normalize import matplotlib.cm as cm import m...
github_jupyter
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_05_3_keras_l1_l2.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 ...
github_jupyter
# Saving a web page to scrape later For many scraping jobs, it makes sense to first save a copy of the web page (or pages) that you want to scrape and then operate on the local files you've saved. This is a good practice for a couple of reasons: You won't be bombarding your target server with requests every time you f...
github_jupyter
``` import pandas as pd nhl_games= pd.read_csv("/Users/joejohns/data_bootcamp/GitHub/final_project_nhl_prediction/Data/Kaggle_Data_Ellis/game.csv") nhl_games.columns nhl_20162017 = nhl_games.loc[(nhl_games['season'] == 20162017)&(nhl_games['type'] == 'R') , ['game_id', 'season', 'type', 'date_time_GMT', 'away_team_id'...
github_jupyter
# Handle shapefiles using Geopandas ``` ############################################################################################### ############################################################################################### # Part 1: work with shapefiles # I am using a "shapefile" which consists of at least fo...
github_jupyter
# Task 1: Getting started with Numpy Let's spend a few minutes just learning some of the fundamentals of Numpy. (pronounced as num-pie **not num-pee**) ### what is numpy Numpy is a Python library that support large, multi-dimensional arrays and matrices. Let's look at an example. Suppose we start with a little tab...
github_jupyter
# Intake / Pangeo Catalog: Making It Easier To Consume Earth’s Climate and Weather Data Anderson Banihirwe (abanihi@ucar.edu), Charles Blackmon-Luca (blackmon@ldeo.columbia.edu), Ryan Abernathey (rpa@ldeo.columbia.edu), Joseph Hamman (jhamman@ucar.edu) - NCAR, Boulder, CO, USA - Columbia University, Palisades, NY, US...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np import pyart import scipy radar = pyart.io.read('/home/zsherman/cmac_test_radar.nc') radar.fields.keys() max_lat = 37 min_lat = 36 min_lon = -98.3 max_lon = -97 lal = np.arange(min_lat, max_lat, .2) lol = np.arange(min_lon, max_lon, .2) display = pyart.graph.Radar...
github_jupyter
# 第2回 ベクトル空間モデル この演習ページでは,ベクトル空間モデルに基づく情報検索モデルについて説明します.具体的には,文書から特徴ベクトルへの変換方法,TF-IDFの計算方法,コサイン類似度による文書ランキングについて,その実装例を説明します.第2回演習の最終目的は,ある与えられた文書コーパスに対して,TF-IDFで重み付けされた特徴ベクトルによる文書ランキングが実装できるようになることです. ## ライブラリ この回の演習では,以下のライブラリを使用します.  - [numpy, scipy](http://www.numpy.org/) + Pythonで科学技術計算を行うための基礎的なライブラリ. - [gens...
github_jupyter
``` !pip install roboschool==1.0.48 gym==0.15.4 import tensorflow as tf import numpy as np import gym import roboschool class TD3PG: def __init__(self,env,memory): self.env=env self.state_dimension=env.observation_space.shape self.action_dimension=env.action_space.shape[0] self.min_action=env.action_...
github_jupyter
# Exploring Text Data (2) ## PyConUK talk abstract Data set of abstracts for the PyConUK 2016 talks (retrieved 14th Sept 2016 from https://github.com/PyconUK/2016.pyconuk.org) The data can be found in `../data/pyconuk2016/{keynotes,workshops,talks}/*` There are 101 abstracts ## Load the data Firstly, we load all ...
github_jupyter
# Explicit Feedback Neural Recommender Systems Goals: - Understand recommender data - Build different models architectures using Keras - Retrieve Embeddings and visualize them - Add metadata information as input to the model ``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np import os.path as o...
github_jupyter
``` import sys sys.path.insert(0, '/cndd/fangming/CEMBA/snmcseq_dev') from __init__ import * from snmcseq_utils import cd from snmcseq_utils import create_logger # from CEMBA_update_mysql import connect_sql log = create_logger() log.info("Hello") # input_f = '/cndd2/fangming/projects/scf_enhancers/data/bulk/round2/mc...
github_jupyter
# Loading Libraries ``` # Importing the core libraies import numpy as np import pandas as pd from IPython.display import Markdown from datetime import timedelta from datetime import datetime import plotly.express as px import plotly.graph_objs as go !pip install pycountry import pycountry from plotly.offline import...
github_jupyter
Author: Maxime Marin @: mff.marin@gmail.com # Accessing IMOS data case studies: Walk-through and interactive session - Analysis In this notebook, we will provide a receipe for further analysis to be done on the same dataset we selected earlier. In the future, a similar notebook can be tailored to a particular datas...
github_jupyter
``` """The purpose of this tutorial is to introduce you to: (1) how gradient-based optimization of neural networks operates in concrete practice, and (2) how different forms of learning rules lead to more or less efficient learning as a function of the shape of the optimization landscape ...
github_jupyter
## Problem Statement An experimental drug was tested on 2100 individual in a clinical trial. The ages of participants ranged from thirteen to hundred. Half of the participants were under the age of 65 years old, the other half were 65 years or older. Ninety five percent patients that were 65 years or older exper...
github_jupyter
# Riemannian Optimisation with Pymanopt for Inference in MoG models The Mixture of Gaussians (MoG) model assumes that datapoints $\mathbf{x}_i\in\mathbb{R}^d$ follow a distribution described by the following probability density function: $p(\mathbf{x}) = \sum_{m=1}^M \pi_m p_\mathcal{N}(\mathbf{x};\mathbf{\mu}_m,\mat...
github_jupyter
# 样式迁移 如果你是一位摄影爱好者,你也许接触过滤镜。它能改变照片的颜色样式,从而使风景照更加锐利或者令人像更加美白。但一个滤镜通常只能改变照片的某个方面。如果要照片达到理想中的样式,你可能需要尝试大量不同的组合。这个过程的复杂程度不亚于模型调参。 在本节中,我们将介绍如何使用卷积神经网络,自动将一个图像中的样式应用在另一图像之上,即*样式迁移*(style transfer) :cite:`Gatys.Ecker.Bethge.2016`。 这里我们需要两张输入图像:一张是*内容图像*,另一张是*样式图像*。 我们将使用神经网络修改内容图像,使其在样式上接近样式图像。 例如, :numref:`fig_style_tran...
github_jupyter
``` !pip install -U -q pyDrive from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from google.colab import auth from oauth2client.client import GoogleCredentials auth.authenticate_user() gauth = GoogleAuth() gauth.credentials = GoogleCredentials.get_application_default() drive = GoogleDrive(gauth...
github_jupyter
``` import os import csv import platform import pandas as pd import networkx as nx from graph_partitioning import GraphPartitioning, utils run_metrics = True cols = ["WASTE", "CUT RATIO", "EDGES CUT", "TOTAL COMM VOLUME", "Qds", "CONDUCTANCE", "MAXPERM", "NMI", "FSCORE", "FSCORE RELABEL IMPROVEMENT", "LONELINESS"] p...
github_jupyter
``` %%capture !pip install wikidataintegrator from rdflib import Graph, URIRef from wikidataintegrator import wdi_core, wdi_login from datetime import datetime import copy import pandas as pd import getpass print("username:") username = input() print("password:") password = getpass.getpass() login = wdi_login.WDLogin(u...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from sklearn import svm import pandas as pd import seaborn as sns from sklearn import svm from sklearn.model_selection import train_test_split from sklearn import metrics from sklearn import neighbors, datasets from sklearn.model_selection import cross_val_score fr...
github_jupyter
``` import sys sys.executable import argparse import math import h5py import numpy as np import tensorflow as tf import socket import glob import os import sys import h5py import provider import tf_util from model import * from plyfile import PlyData, PlyElement print("success") BATCH_SIZE = 1 BATCH_SIZE_EVAL = 1 NUM...
github_jupyter
# Thực hiện học trên model ``` # import import random import math import time import pandas as pd import numpy as np import torch import torch.utils.data as data import torch.nn as nn import torch.nn.functional as F import torch.optim as optim # Thiết định các giá trị ban đầu torch.manual_seed(1234) np.random.seed(123...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
![rmotr](https://user-images.githubusercontent.com/7065401/52071918-bda15380-2562-11e9-828c-7f95297e4a82.png) <hr style="margin-bottom: 40px;"> <img src="https://user-images.githubusercontent.com/7065401/58563302-42466a80-8201-11e9-9948-b3e9f88a5662.jpg" style="width:400px; float: right; margin: 0 40px 40px 40px;"...
github_jupyter
``` # Dataset from here # https://archive.ics.uci.edu/ml/datasets/Adult import great_expectations as ge import matplotlib.pyplot as plt import pandas as pd import numpy as np %matplotlib inline """ age: continuous. workclass: Private, Self-emp-not-inc, Self-emp-inc, Federal-gov, Local-gov, State-gov, Without-pay, Never...
github_jupyter
# Nothing But NumPy: A 3-layer Binary Classification Neural Network on Iris Flowers Part of the blog ["Nothing but NumPy: Understanding & Creating Binary Classification Neural Networks with Computational Graphs from Scratch"](https://medium.com/@rafayak/nothing-but-numpy-understanding-creating-binary-classification-ne...
github_jupyter
``` import san from src_end2end import statistical_features import lsa_features import pickle import numpy as np from tqdm import tqdm import pandas as pd import os import skopt from skopt import gp_minimize from sklearn import preprocessing from skopt.space import Real, Integer, Categorical from skopt.utils import use...
github_jupyter
``` # default_exp qlearning.dqn_target #export import torch.nn.utils as nn_utils from fastai.torch_basics import * from fastai.data.all import * from fastai.basics import * from dataclasses import field,asdict from typing import List,Any,Dict,Callable from collections import deque import gym import torch.multiprocessin...
github_jupyter
# 1. Import Libraries ``` import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.pipeline import Pipeline from sklearn.compose import ColumnTransformer from jcopml.pipeline import num_pipe, cat_pipe from jcopml.utils import save_model, load_model from jcopml.plot imp...
github_jupyter
# Programming_Assingment17 ``` Question1. Create a function that takes three arguments a, b, c and returns the sum of the numbers that are evenly divided by c from the range a, b inclusive. Examples evenly_divisible(1, 10, 20) ➞ 0 # No number between 1 and 10 can be evenly divided by 20. evenly_divisible(1, 10, 2) ➞ ...
github_jupyter
## Importing necessary packages ``` import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) # preprocessing/decomposition from sklearn.preprocessing import LabelEncoder, StandardScaler, OneHotEncoder from sklearn.decomposition import PCA, FastICA, FactorAnalysis, Ker...
github_jupyter
# Simulating a Predator and Prey Relationship Without a predator, rabbits will reproduce until they reach the carrying capacity of the land. When coyotes show up, they will eat the rabbits and reproduce until they can't find enough rabbits. We will explore the fluctuations in the two populations over time. # Using Lo...
github_jupyter
``` import csv import pickle import pandas as pd import numpy as np import requests import json import seaborn as sns import matplotlib.pyplot as plt from scipy import stats import sklearn.preprocessing from sklearn import preprocessing data=pd.read_csv("temp1-costamesa.csv") data data.columns data=data.drop_duplica...
github_jupyter
# Late contributions Received and Made ## Setup ``` %load_ext sql from django.conf import settings connection_string = 'postgresql+psycopg2://{USER}:{PASSWORD}@{HOST}:{PORT}/{NAME}'.format( **settings.DATABASES['default'] ) %sql $connection_string ``` ## Unique Composite Key The documentation says that the reco...
github_jupyter
# Basics Let's first take a look at what's inside the ``ib_insync`` package: ``` import ib_insync print(ib_insync.__all__) ``` ### Importing The following two lines are used at the top of all notebooks. The first line imports everything and the second starts an event loop to keep the notebook live updated: ``` from...
github_jupyter
# Practical 2 - Loops and conditional statements In today's practical we are going to continue practicing working with loops whilst also moving on to the use of conditional statements. <div class="alert alert-block alert-success"> <b>Objectives:</b> The objectives of todays practical are: - 1) [Loops: FOR loops con...
github_jupyter
## Imports ``` from __future__ import print_function, division import pandas as pd import numpy as np import statsmodels.api as sm import statsmodels.formula.api as smf import patsy import seaborn as sns import matplotlib.pyplot as plt import scipy.stats as stats %matplotlib inline from sklearn.linear_model import L...
github_jupyter
``` %tensorflow_version 1.x #Suppress warnings which keep poping up import warnings warnings.filterwarnings("ignore") from keras import backend as K import time import matplotlib.pyplot as plt import numpy as np % matplotlib inline np.random.seed(2017) from keras.models import Sequential from keras.layers.convoluti...
github_jupyter
``` from sympy import pi, cos, sin, symbols from sympy.utilities.lambdify import implemented_function import pytest from sympde.calculus import grad, dot from sympde.calculus import laplace from sympde.topology import ScalarFunctionSpace from sympde.topology import element_of from sympde.topology import NormalVector f...
github_jupyter
``` import re ``` The re module uses a backtracking regular expression engine Regular expressions match text patterns Use case examples: - Check if an email or phone number was written correctly. - Split text by some mark (comma, dot, newline) which may be useful to parse data. - Get content from HTML tags. - Impr...
github_jupyter
<table> <tr> <td style="background-color:#ffffff;"> <a href="http://qworld.lu.lv" target="_blank"><img src="..\images\qworld.jpg" width="25%" align="left"> </a></td> <td style="background-color:#ffffff;vertical-align:bottom;text-align:right;"> prepared by <a href="http://abu.lu....
github_jupyter
# Document classifier Praktisch wenn eine Menge Dokumente sortiert werden muss ## Daten - Wir brauchen zuerst daten um unser Modell zu trainieren ``` #!pip3 install -U textblob from textblob.classifiers import NaiveBayesClassifier train = [ ('I love this sandwich.', 'pos'), ('this is an amazing place!', 'po...
github_jupyter
# A simple DNN model built in Keras. Let's start off with the Python imports that we need. ``` import os, json, math import numpy as np import shutil import tensorflow as tf print(tf.__version__) ``` ## Locating the CSV files We will start with the CSV files that we wrote out in the [first notebook](../01_explore/t...
github_jupyter
``` import pandas as pd import seaborn as sns import matplotlib.pyplot as plt sns.set_theme(style="whitegrid") sns.set_context("paper") my_data = pd.read_csv("success_rate_RFC_bm5_normal_docking_2.csv") my_data my_data.set_index("Scoring",inplace=True) # sns.barplot(data=my_data[my_data["Method"]=="Pydock"]) # sns.ba...
github_jupyter
``` import numpy as np import torch import pandas as pd import json import seaborn as sns import matplotlib.pyplot as plt from sklearn.preprocessing import LabelEncoder as LE import bisect import torch from datetime import datetime from sklearn.model_selection import train_test_split !cp -r drive/My\ Drive/T11 ./T11 np...
github_jupyter
# CaptureFile - Transactional record logging library ## Overview Capture files are compressed transactional record logs and by convention use the extension ".capture". Records can be appended but not modified and are explicitly committed to the file. Any records that are added but not committed will not be visible t...
github_jupyter
### Code to implement Graphs ``` class DiGraphAsAdjacencyMatrix: def __init__(self): #would be better a set, but I need an index self.__nodes = list() self.__matrix = list() def __len__(self): """gets the number of nodes""" return len(self.__nodes) ...
github_jupyter
# NMF Analysis Performs a simple tf-idf of the question pairs and NMF dimension reduction to calculate cosine similarity of each question pair. The goal of the analysis is to see if the pairs labeled as duplicates have a distinctly different cosine similarity compared to those pairs marked as not duplicates. ``` # da...
github_jupyter
``` %matplotlib inline import pandas as pd import matplotlib.pyplot as plt import numpy as np import statsmodels.api as sm from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from marshmallow import Schema, fields, post_load # pip install marshmallow # SQLite import s...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
# Multivariate Dependencies Beyond Shannon Information This is a companion Jupyter notebook to the work *Multivariate Dependencies Beyond Shannon Information* by Ryan G. James and James P. Crutchfield. This worksheet was written by Ryan G. James. It primarily makes use of the ``dit`` package for information theory cal...
github_jupyter
``` %run technical_trading.py #%% data = pd.read_csv('../../data/hs300.csv',index_col = 'date',parse_dates = 'date') data.vol = data.vol.astype(float) #start = pd.Timestamp('2005-09-01') #end = pd.Timestamp('2012-03-15') #data = data[start:end] #%% chaikin = CHAIKINAD(data, m = 14, n = 16) kdj = KDJ(data) adx = ADX(dat...
github_jupyter
<img src=https://a-static.projektn.sk/2020/11/Startup.jpg> # Startup Profit Prediction # 1. Reading and Understanding the Data ``` #basic libraries and visualization import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns #statmodels import statsmodels.api as sm from statsmodels....
github_jupyter
``` import os import requests from bs4 import BeautifulSoup import pandas as pd from splinter import Browser import splinter import numpy as np # create variables to store scraped info movie_titles = [] opening_amts = [] total_gross = [] per_of_total = [] num_of_theaters = [] open_date = [] # loop through pages to get ...
github_jupyter
# DAT257x: Reinforcement Learning Explained ## Lab 2: Bandits ### Exercise 2.3: UCB ``` import numpy as np import sys if "../" not in sys.path: sys.path.append("../") from lib.envs.bandit import BanditEnv from lib.simulation import Experiment #Policy interface class Policy: #num_actions: (int) Number of a...
github_jupyter
<p><img src="https://oceanprotocol.com/static/media/banner-ocean-03@2x.b7272597.png" alt="drawing" width="800" align="center"/> <h1><center>Ocean Protocol - Manta Ray project</center></h1> <h3><center>Decentralized Data Science and Engineering, powered by Ocean Protocol</center></h3> <p>Version 0.5.3 - beta</p> <p>P...
github_jupyter
# Exercise 1 Add the specified code for each code cell, running the cells _in order_. Write a **`while`** loop that prints out every 5th number (multiples of 5) from 0 to 100 (inclusive). - _Tip:_ use an **`end=','`** keyword argument to the `print()` function to print all the numbers on the same line. ``` nums = 0 w...
github_jupyter
``` import numpy as np import torch import torchvision import torch.nn as nn import torch.optim as optim from nn_interpretability.interpretation.lrp.lrp_0 import LRP0 from nn_interpretability.interpretation.lrp.lrp_eps import LRPEpsilon from nn_interpretability.interpretation.lrp.lrp_gamma import LRPGamma from nn_inte...
github_jupyter
<img src="images/bannerugentdwengo.png" alt="Banner" width="400"/> <div> <font color=#690027 markdown="1"> <h1>BESLISSINGSBOOM</h1> </font> </div> <div class="alert alert-box alert-success"> In deze notebook laat je Python een beslissingsboom genereren op basis van een tabel met gelabelde voorbeelden...
github_jupyter
# Project 1: Linear Regression Model This is the first project of our data science fundamentals. This project is designed to solidify your understanding of the concepts we have learned in Regression and to test your knowledge on regression modelling. There are four main objectives of this project. 1\. Build Linear Re...
github_jupyter
[SCEC BP3-QD](https://strike.scec.org/cvws/seas/download/SEAS_BP3.pdf) document is here. # [DRAFT] Quasidynamic thrust fault earthquake cycles (plane strain) ## Summary * Most of the code here follows almost exactly from [the previous section on strike-slip/antiplane earthquake cycles](c1qbx/part6_qd). * Since the f...
github_jupyter
# 머신 러닝 교과서 3판 # 9장 - 웹 애플리케이션에 머신 러닝 모델 내장하기 **아래 링크를 통해 이 노트북을 주피터 노트북 뷰어(nbviewer.jupyter.org)로 보거나 구글 코랩(colab.research.google.com)에서 실행할 수 있습니다.** <table class="tfo-notebook-buttons" align="left"> <td> <a target="_blank" href="https://nbviewer.org/github/rickiepark/python-machine-learning-book-3rd-edition...
github_jupyter
``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt df = pd.read_csv('Data/20200403-WHO.csv') df df = df[df['Country/Territory'] != 'conveyance (Diamond'] death_rate = df['Total Deaths']/df['Total Confirmed']*100 df['Death Rate'] = death_rate df countries_infected = len(df)...
github_jupyter
#Gaussian bayes classifier In this assignment we will use a Gaussian bayes classfier to classify our data points. # Import packages ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.stats import multivariate_normal from sklearn.metrics import classification_report from matplotlib ...
github_jupyter
# BLU02 - Learning Notebook - Data wrangling workflows - Part 2 of 3 ``` import matplotlib.pyplot as plt import pandas as pd import os ``` # 2 Combining dataframes in Pandas ## 2.1 How many programs are there per season? How many different programs does the NYP typically present per season? Programs are under `/d...
github_jupyter
``` %matplotlib inline ``` # Faces dataset decompositions This example applies to `olivetti_faces` different unsupervised matrix decomposition (dimension reduction) methods from the module :py:mod:`sklearn.decomposition` (see the documentation chapter `decompositions`) . ``` print(__doc__) # Authors: Vlad Niculae...
github_jupyter
# In this step, we'll process graduation data from the federal files ## In most cases, this is a straight "pull" from the data, but there are a few possible modifications: - If the sample is too small from the most recent year, use 3 years of data - For HBCUs, boost by 15% - For a handful of schools, adjust down to re...
github_jupyter
# Straighten an image using the Hough transform We'll write our own Hough transform to compute the Hough transform and use it to straighten a wonky image. ## Package inclusion for Python ``` import copy import math import numpy as np import cv2 ``` ## Read the image from a file on the disk and return a new matrix ...
github_jupyter
``` # 초기 설정 from IPython.core.display import display, HTML display(HTML("<style>.container { width: 100% !important; }</style>")) pd.set_option("display.max_columns", 40) import missingno as msno %matplotlib inline import pprint import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as ...
github_jupyter
# Demonstration notebook to search, list product and download a band This notebook is defined in four different sections: 1. Import requirements and definition of the parameters 2. Search for cached products 3. Listing the bands of one product 4. Downloading a band ## Import requirements and definition of the paramet...
github_jupyter
Wayne H Nixalo - 09 Aug 2017 This JNB is an attempt to do the neural artistic style transfer and super-resolution examples done in class, on a GPU using PyTorch for speed. Lesson NB: [neural-style-pytorch](https://github.com/fastai/courses/blob/master/deeplearning2/neural-style-pytorch.ipynb) ## Neural Style Transfe...
github_jupyter
# In-Class Coding Lab: Conditionals The goals of this lab are to help you to understand: - Relational and Logical Operators - Boolean Expressions - The if statement - Try / Except statement - How to create a program from a complex idea. # Understanding Conditionals Conditional statements permit the non-linear exec...
github_jupyter
<a href="https://colab.research.google.com/github/gabilodeau/INF6804/blob/master/FeatureVectorsComp.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> INF6804 Vision par ordinateur Polytechnique Montréal Distances entre histogrammes (L1, L2, MDPA, Bh...
github_jupyter
# The IPython widgets, now in IHaskell !! It is highly recommended that users new to jupyter/ipython take the *User Interface Tour* from the toolbar above (Help -> User Interface Tour). > This notebook introduces the [IPython widgets](https://github.com/ipython/ipywidgets), as implemented in [IHaskell](https://github...
github_jupyter
# VARLiNGAM ## Import and settings In this example, we need to import `numpy`, `pandas`, and `graphviz` in addition to `lingam`. ``` import os os.environ["PATH"] += os.pathsep + '/Users/elena/opt/anaconda3/lib/python3.7/site-packages/graphviz' from sklearn.preprocessing import StandardScaler import numpy as np import...
github_jupyter
# Contanimate DNS Data ``` """ Make dataset pipeline """ import pandas as pd import numpy as np import os from collections import Counter import math import torch from torch.utils.data import DataLoader from torch.nn.utils.rnn import pad_sequence from dga.models.dga_classifier import DGAClassifier from dga.datasets.do...
github_jupyter
# Eliminating Outliers Eliminating outliers is a big topic. There are many different ways to eliminate outliers. A data engineer's job isn't necessarily to decide what counts as an outlier and what does not. A data scientist would determine that. The data engineer would code the algorithms that eliminate outliers from...
github_jupyter