text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Learning Scikit-learn: Machine Learning in Python ## IPython Notebook for Chapter 2: Supervised Learning - Estimating Boston house pricing using Linear Regression _In every example we have seen so far, we have faced what in Chapter 1, Machine Learning – A Gentle Introduction, we called classification problems: the ...
github_jupyter
``` !wget --no-check-certificate \ https://storage.googleapis.com/laurencemoroney-blog.appspot.com/horse-or-human.zip \ -O /tmp/horse-or-human.zip !wget --no-check-certificate \ https://storage.googleapis.com/laurencemoroney-blog.appspot.com/validation-horse-or-human.zip \ -O /tmp/validation-horse-or-hu...
github_jupyter
``` %reset import numpy as np import pandas as pd from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten, Conv2D, MaxPooling2D, Lambda, MaxPool2D, BatchNormalization from keras.utils import np_utils from keras.preprocessing.image import ImageDataGenerator from keras.optimizers ...
github_jupyter
``` import json import pathlib import traceback import cf_xarray import fsspec import matplotlib.pyplot as plt import pandas as pd import proplot as pplt import pydantic import xarray as xr import xstac S3_URL = 'https://stratus.ucar.edu' fs = fsspec.filesystem( 's3', profile='stratus-cesm', anon=False, client_kwa...
github_jupyter
<a href="https://colab.research.google.com/github/institutohumai/cursos-python/blob/auto/Scraping/3_Selenium_y_xpath/scraping_por_automatizacion_solucion.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" data-canonical-src="https://colab.research.google.com/...
github_jupyter
<a href="https://colab.research.google.com/github/sidharth178/The-Battle-of-Neighborhoods-Capstone-Project/blob/master/The_Battle_Of_Neighborhoods.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # <center>**===========The Battle Of Neighborhoods====...
github_jupyter
## From HyTcWaves: Obtain TC parameters associated with maximum TWL ``` #!/usr/bin/env python # -*- coding: utf-8 -*- # common import os import os.path as op import pandas as pd import matplotlib.pyplot as plt from matplotlib import gridspec # pip import xarray as xr import numpy as np # DEV: override installed tes...
github_jupyter
### **TODO:** Also extract additional links from the `links` keys ``` import pandas as pd import os import ijson import json import gzip import itertools import sys sys.path.append("../../src/data") from content_api_extract import extract_link_types from extract_text_utils import get_text from datetime import datetime...
github_jupyter
![Callysto.ca Banner](https://github.com/callysto/curriculum-notebooks/blob/master/callysto-notebook-banner-top.jpg?raw=true) <a href="https://hub.callysto.ca/jupyter/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fcallysto%2Fcurriculum-notebooks&branch=master&subPath=Health/CALM/CALM-moving-out.ipynb&depth...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from tensorflow.keras.models import Sequential import os import cv2 os.getcwd() os.chdir('D:') os.getcwd() root_directory = os.path.join(os.getcwd(), 'naruto_anime') os.chdir(...
github_jupyter
# Structured data prediction using Cloud ML Engine This notebook illustrates: 1. Exploring a BigQuery dataset using JupyterLab 2. Creating datasets for Machine Learning using Dataflow 3. Creating a model using the feature columns and Keras API 4. Training on Cloud AI Platform 5. Deploying model 6. Predicting with mod...
github_jupyter
# Patchify and plot images Refer to [the installation section in README](https://github.com/Living-with-machines/MapReader#installation) to install `mapreader`. ``` # solve issue with autocomplete %config Completer.use_jedi = False %load_ext autoreload %autoreload 2 %matplotlib inline ``` ## Load images Example im...
github_jupyter
# Imputing Missing Values in Data ## Load Data ``` import sys,tempfile, urllib, os import pandas as pd from sklearn.model_selection import train_test_split import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set() BASE_DIR = '/tmp' OUTPUT_FILE = os.path.join(BASE_DIR, 'churn_data.csv') ``` ...
github_jupyter
# Demo 5: Creating Denormalized Tables <img src="images/postgresql-logo.png" width="250" height="250"> ### Walk through the basics of modeling data from normalized from to denormalized form. In this demo, we will: <br> <ol><li>Create tables in PostgreSQL<li>Insert rows of data<li>Do simple JOIN SQL queries to show ho...
github_jupyter
# HEX algorithm **Kopuru Vespa Velutina Competition** **XGBoost model** Purpose: Predict the number of Nests in each of Biscay's 112 municipalities for the year 2020. Output: *(WaspBusters_20210624_months_SKLearnAVGBaseHybrid.csv)* @authors: * mario.bejar@student.ie.edu * pedro.geirinhas@student.ie.edu * a.berrizbe...
github_jupyter
``` import os import pandas as pd path = './fashion_mnist' tr = pd.read_csv(os.path.join(path, 'fashion-mnist_train.csv')) test = pd.read_csv(os.path.join(path, 'fashion-mnist_test.csv')) print('train data: ', tr.shape) print('test data: ', test.shape) tr.head() print('label 종류: ', set(tr['label'])) for i in range(10)...
github_jupyter
``` # Importing necessary packages TEST test from datetime import date, timedelta import os import requests import shutil import pandas as pd import numpy as np import spotipy from spotipy.oauth2 import SpotifyClientCredentials import tqdm import logging # Set start date and end date, with 7 days interval start = date(...
github_jupyter
# ORION Orientation Estimation Using Commodity Wi-Fi With MIMO, Wi-Fi led the way to the adoption of antenna array signal processing techniques for fine-grained localization using commodity hardware. MIMO techniques, previously exclusive to specific domains of applications for instance radar systems, allow to consi...
github_jupyter
# Evaluating Model Performance In this demo, we'll be using the Red Wine Quality dataset. The datset can be used in both regression and classification models. The purpose of this notebook is to build different models, classifiers and regressors, and compare their performance to see which one performs the best on our d...
github_jupyter
<a id='start'></a> # Reti neurali con Tensor Flow In questo notebook vengono presentati degli esercizi sulle reti neurali con Tensor Flow. Provate a svolgere il seguente esercizio:<br> 1) [pp -> H -> ZZ -> 4lepton](#section1)<br> <a id='section1'></a> ## pp -> H -> ZZ -> 4lepton Creare una rete neurale per analizza...
github_jupyter
# 2. Exploring the relationship between gender and policing **Does the gender of a driver have an impact on police behavior during a traffic stop? In this chapter, you will explore that question while practicing filtering, grouping, method chaining, Boolean math, string methods, and more!** ``` import pandas as pd ri ...
github_jupyter
# Topic Modeling on London court cases We're going to be using a topic model to explore transcripts from court cases in London from 1820-1830. A topic model is similar to a document clustering algorithm, but instead of grouping together documents we're going to group together word *tokens*. A document can thus "belong...
github_jupyter
# Loading data into StellarGraph from NumPy > This demo explains how to load data from NumPy into a form that can be used by the StellarGraph library. [See all other demos](../README.md). <table><tr><td>Run the latest release of this notebook:</td><td><a href="https://mybinder.org/v2/gh/stellargraph/stellargraph/mast...
github_jupyter
# Tables & Figures Generation [![Binder](https://notebooks.gesis.org/binder/badge_logo.svg)](https://notebooks.gesis.org/binder/v2/gh/AyrtonB/Merit-Order-Effect/main?filepath=nbs%2Fdev-09-tables-and-figures.ipynb) This notebook provides a programmatic workflow for generating the tables used in the MOE paper, as well ...
github_jupyter
# TensorNetworks in Neural Networks. Here, we have a small toy example of how to use a TN inside of a fully connected neural network. First off, let's install tensornetwork ``` !pip install tensornetwork import numpy as np import matplotlib.pyplot as plt import tensorflow as tf tf.enable_v2_behavior() # Import tens...
github_jupyter
### Notebook for Understanding Basics of Conjugate Priors ``` import math import numpy as np import matplotlib import matplotlib.pyplot as plt import scipy.stats as sstat import seaborn as sns # if necessary ``` #### Check Beta Distribution which is Conjugate to Bernoulli Likelihood Check Beta Distribution defin...
github_jupyter
``` import math class Geo: #limited to taking in decimal lat and long def __init__(self, lat, long): self.lat = lat self.long = long @staticmethod def deg_to_dms(deg, type='lat'): decimals, number = math.modf(deg) d = deg m = decimals * 60 s = (de...
github_jupyter
``` import re import readwrite.write_snippets as ws ``` # Regular VSCode snippets Include multi-line snippets? ``` multiline = True ``` Include single-line snippets? ``` singleline = True ``` Convert `$...$` to `\(...\)`? ``` dollarfix = False ``` Use text/math modes for snippets where available? ``` textmaths...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt class Market: def __init__(self, a_d, b_d, a_z, b_z, tax): self.a_d = a_d self.b_d = b_d self.a_z = a_z self.b_z = b_z self.tax = tax self.eprice = 0 self.equantity = 0 def price(self): ...
github_jupyter
# Desafio 3 Neste desafio, iremos praticar nossos conhecimentos sobre distribuições de probabilidade. Para isso, dividiremos este desafio em duas partes: 1. A primeira parte contará com 3 questões sobre um *data set* artificial com dados de uma amostra normal e uma binomial. 2. A segunda parte será sobre a an...
github_jupyter
- data downloaded from: http://hmp2-data.stanford.edu/index.php# - reference study design: https://www.cell.com/cell-host-microbe/fulltext/S1931-3128(14)00306-0?_returnURL=http%3A%2F%2Flinkinghub.elsevier.com%2Fretrieve%2Fpii%2FS1931312814003060%3Fshowall%3Dtrue - shannon diversity: protein (take exponential to ensure ...
github_jupyter
``` #!/usr/bin/env python3 # coding=utf-8 import spotipy import spotipy.util as util from spotipy.oauth2 import SpotifyClientCredentials from pprint import pprint from dotenv import load_dotenv import os ``` import sys if len(sys.argv) > 3:<br> username = sys.argv[1]<br> playlist_id = sys.argv[2]<br> trac...
github_jupyter
# Googleドライブから学習データをロード ``` from google.colab import drive drive.mount('./gdrive') !cp '/content/gdrive/MyDrive/ReversiTrainData/X_dataset2.npy' ./ !cp '/content/gdrive/MyDrive/ReversiTrainData/y_dataset2.npy' ./ import numpy as np X_dataset = np.load('X_dataset2.npy') y_dataset = np.load('y_dataset2.npy') print(...
github_jupyter
``` %matplotlib inline %load_ext autoreload %autoreload 2 import os import sys import numpy as np import astropy.units as u from astropy import wcs from astropy.io import fits from astropy.coordinates import SkyCoord from astropy.visualization import make_lupton_rgb from astropy.utils.data import download_file, clea...
github_jupyter
Title: RP- Spatial Accessibility of COVID-19 Healthcare Resources in Illinois Pre-Processing Script --- This is a script that automates as much of the data gathering and pre-processing as possible for reproduction of Kang et al. (2020). **Reproduction of**: Rapidly measuring spatial accessibility of COVID-19 healthca...
github_jupyter
# Multi-Layer Perceptron, MNIST --- In this notebook, we will train an MLP to classify images from the [MNIST database](http://yann.lecun.com/exdb/mnist/) hand-written digit database. The process will be broken down into the following steps: >1. Load and visualize the data 2. Define a neural network 3. Train the model...
github_jupyter
``` from keras.models import Model from keras.layers import Input, LSTM, Dense import numpy as np batch_size = 64 # Batch size for training. epochs = 100 # Number of epochs to train for. latent_dim = 256 # Latent dimensionality of the encoding space. num_samples = 10000 # Number of samples to train on. # Path to th...
github_jupyter
# Machine Learning con Python ![Texto alternativo](./img/machine-learning.jpg) ## Índice 1. **[¿Qué es Machine Learning?](#1.-¿Qué-es-Machine-Learning?)** 2. **[Tipos de Machine Learning](#2.-Tipos-de-Machine-Learning)** * [2.1 Aprendizaje supervisado](#2.1-Aprendizaje-supervisado) * [2.2 Aprendizaje no sup...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/training-with-deep-learning/train-hyperparameter-tune-deploy-with-tensorflow/train-hyperparameter-tun...
github_jupyter
``` #Importing Packages import numpy as np import pandas as pd import pandas_profiling import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline from matplotlib.backends.backend_pdf import PdfPages import statsmodels.formula.api as sm from sklearn.model_selection import train_test_split from sklearn im...
github_jupyter
# 1.Spotting Most important features ``` # %matplotlib inline import xgboost as xgb import seaborn as sns import pandas as pd sns.set(font_scale = 1.5) dtrain = xgb.DMatrix('./resources/agaricus.txt.train') dtest = xgb.DMatrix('./resources/agaricus.txt.test') # specify training parameters params = { 'objective':...
github_jupyter
``` #hide #skip ! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab #default_exp callback.tensorboard #all_slow #export from fastai.basics import * ``` # Tensorboard > Integration with [tensorboard](https://www.tensorflow.org/tensorboard) First thing first, you need to install tensorboard with ``...
github_jupyter
**Chapter 4 – Huấn luyện Mô hình Tuyến tính** _Notebook này chứa toàn bộ mã nguồn mẫu và lời giải bài tập Chương 4 - tập 1._ <table align="left"> <td> <a href="https://colab.research.google.com/github/mlbvn/handson-ml2-vn/blob/main/04_training_linear_models.ipynb" target="_parent"><img src="https://colab.resear...
github_jupyter
# 4.3 アルゴリズム選択 ``` # 日本語化ライブラリ導入 !pip install japanize-matplotlib | tail -n 1 # 共通事前処理 # 余分なワーニングを非表示にする import warnings warnings.filterwarnings('ignore') # 必要ライブラリのimport import pandas as pd import numpy as np import matplotlib.pyplot as plt # matplotlib日本語化対応 import japanize_matplotlib # データフレーム表示用関数 from IPytho...
github_jupyter
# Homework: Mad Libs! ## The Problem Write a Python program which creates your own unique Mad-Libs! story. This is very similar to the example we did in large group only now you will devise and program your own unique story. If you are not familar with a Mad-Libs! stories, check out: http://www.madlibs.com and http...
github_jupyter
``` import tensorflow as tf tf.config.experimental.list_physical_devices() tf.test.is_built_with_cuda() ``` # Importing Libraries ``` import numpy as np import pandas as pd from matplotlib import pyplot as plt import os.path as op import pickle import tensorflow as tf from tensorflow import keras from keras.models im...
github_jupyter
# Capsule Networks (CapsNets) # 胶囊网络(CapsNets) Based on the paper: [Dynamic Routing Between Capsules](https://arxiv.org/abs/1710.09829), by Sara Sabour, Nicholas Frosst and Geoffrey E. Hinton (NIPS 2017). 基于这篇论文:[Dynamic Routing Between Capsules](https://arxiv.org/abs/1710.09829),作者Sara Sabour, Nicholas Frosst 和 Geof...
github_jupyter
``` import os import ase from ase import Atoms import numpy as np import tqdm import ase.io from nice.blocks import * from nice.utilities import * from matplotlib import pyplot as plt from sklearn.linear_model import BayesianRidge PROPERTIES_NAMES = [ 'tag', 'index', 'A', 'B', 'C', 'mu', 'alpha', 'homo', 'lumo', 'g...
github_jupyter
# Running Code First and foremost, the IPython Notebook is an interactive environment for writing and running code. IPython is capable of running code in a wide range of languages. However, this notebook, and the default kernel in IPython 2.0, runs Python code. ## Code cells allow you to enter and run Python code Ru...
github_jupyter
``` %matplotlib inline import argparse import os import sys import matplotlib.pyplot as plt import numpy as np import scipy.spatial.distance import cpc.feature_loader as fl import cpc.train as tr from cpc.dataset import AudioBatchData, findAllSeqs, filterSeqs, parseSeqLabels sys.path.append(os.path.dirname(tr.__file_...
github_jupyter
# Tarea N°02 ## Instrucciones 1.- Completa tus datos personales (nombre y rol USM) en siguiente celda. **Nombre**:Andrés Montecinos López **Rol**:201204515-0 2.- Debes pushear este archivo con tus cambios a tu repositorio personal del curso, incluyendo datos, imágenes, scripts, etc. 3.- Se evaluará: - Soluciones ...
github_jupyter
# Computer Vision Nanodegree ## Project: Image Captioning --- In this notebook, you will train your CNN-RNN model. You are welcome and encouraged to try out many different architectures and hyperparameters when searching for a good model. This does have the potential to make the project quite messy! Before subm...
github_jupyter
``` from __future__ import print_function # to be able to see plots %matplotlib inline import matplotlib.pyplot as plt import numpy as np import sys sys.path.append("../tools") from tools import collage # just to use a fraction of GPU memory # This is not needed on dedicated machines. # Allows you to share the ...
github_jupyter
##### Copyright 2018 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" } # you may not use this file except in compliance with the License. # You may obtain a copy of the License at...
github_jupyter
# Notes for Unit 1 This is where I put my notes for the very first unit's video: **Video Link:** https://www.freecodecamp.org/learn/machine-learning-with-python/tensorflow/introduction-machine-learning-fundamentals **Artificial Intelligence vs Neural Networks vs Machine Learning**: * **Artificial Intelligence** * ...
github_jupyter
``` 0 << 2 from typing import List class TrieNode: def __init__(self): self.next = [None, None] # self.next[0] 表示 0, self.next[1] 表示1 class Solution: def maximizeXor(self, nums: List[int], queries: List[List[int]]) -> List[int]: nums.sort() # 按照 queries[1] 的大小进行排序 # 按照...
github_jupyter
# Identifying country names from incomplete house addresses <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"> <ul class="toc-item"> <li><span><a href="#Introduction" data-toc-modified-id="Introduction-1">Introduction</a></span></li> <li><span><a href="#Prerequisites" data-toc-modified-id="Prere...
github_jupyter
# Learning Objectives - Understand HPC concepts: automating data-mining process through the Palmetto Supercomputer ** Python cell magic: ** - Specify at top of cell - Prefixed by %% - Enable functionality on cell' contents ** writefile: ** - %%writefile *path-to-filename* ## Where am I? ``` !ls %%writefile mine_i...
github_jupyter
# ipyvuetify Tutorial 08 - Custom Components This is number 8 in a series of ipyvuetify app development tutorials. If you're just getting started with ipyvuetify and haven't checked out the first tutorial "01 Installation and First Steps.ipynb", be sure to check that one out first. First of all, we'll load the requir...
github_jupyter
# Classification -- Images & Hands-On ## Table of Contents <ol> <li>Processing of complicated data like images</li> <li>Thinking about models to use for image classification</li> <li>Implementation of common models</li> <li>Convolutional neural networks -- an ML greatest hit</li> </ol> ## 1. Processin...
github_jupyter
# ALERCE Client ToO Access Demonstrate access to the ALERCE data stream. This notebook demonstrates searches for Type Ia SNe. ``` import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import astropy.units as u from astropy import coordinates from astropy.time import Time from astropy.table imp...
github_jupyter
# Predicting drug-target interaction In this tuorial, we will go through how to run a MolTrans model for compound-protein affinity prediction. In particular, we will demonstrate how to train, validate and test of classification and regression tasks within folder `/apps/drug_target_interaction/moltrans_dti/`. # MolTra...
github_jupyter
# Application of Vertical Federated Learning: Constructing a Credit Score System for the Unlabelled Party Authors: Zhu Xiaochen, Xu Yunfei ## Set up the environment ``` import pandas as pd pd.set_option("display.max_rows", None, "display.max_columns", None) import numpy as np np.set_printoptions(precision=3, suppres...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` #@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.o...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content-dl/blob/main/tutorials/W1D2_LinearDeepLearning/W1D2_Tutorial3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Tutorial 3: Deep linear neural networks **Week 1, Day ...
github_jupyter
# Train VAE for task2... Finally trying more silly attempt; no reconstruction loss. Loss function is now: $loss = 0 L_{Reconstruction} + L_{KLD} = L_{KLD}$ ``` # public modules from dlcliche.notebook import * from dlcliche.utils import ( sys, random, Path, np, plt, EasyDict, ensure_folder, deterministic_ever...
github_jupyter
<a href="https://colab.research.google.com/github/alexmascension/ANMI/blob/main/notebook/T5.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Tema 5: Interpolación de funciones ``` !pip install -r https://raw.githubusercontent.com/alexmascension/AN...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt data=pd.read_csv('derlemler/filtrelenmis_temizlenmis_derlem.csv.gz') # grafik çizimi için yardımcı metot def window_average(x,N): low_index = 0 high_index = low_index + N w_avg = [] while(high_index<len(x)): temp = sum(x[low_index:high_inde...
github_jupyter
# GCB535 - Debugging Code ## Instructions In this adventure, you will practice looking at, identifying, and correcting code that is *buggy*. Check out the code below. I have devided the code into cells (blocks) for you to dissect sequentially, but the ultimate goal here would be code that is fixed such that it "work...
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
# K-Nearest Neighbor Classification ``` import numpy as np import matplotlib.pyplot as plt import pandas as pd ``` ## Data Loading ``` PATH = "../../../Classification/K-NN/Python/Social_Network_Ads.csv" dataset = pd.read_csv(PATH) X = dataset.iloc[:, :-1].values y = dataset.iloc[:, -1].values ``` ## Train Test Spli...
github_jupyter
<a href="https://colab.research.google.com/github/jads-nl/WhirlwindTourOfPython/blob/master/07-Control-Flow-Statements.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <!--BOOK_INFORMATION--> <img align="left" style="padding-right:10px;" src="https:/...
github_jupyter
``` # 需要先安裝 gym[atari] # headless 執行: xvfb-run -a jupyter notebook import gym env = gym.make('Pong-ram-v0') import numpy as np import ipywidgets as W from PIL import Image ``` 看一下基本資訊 ``` env.action_space env.reward_range env.reset() ``` 抓圖出來 ``` Image.fromarray(env.render(mode='rgb_array')) from io import BytesIO ...
github_jupyter
## <center>ML Feature Engineering</center> # <center>Feature Preparation, Selection and Engineering</center> **Author:** João António - joaoantant@gmail.com \& github.com/JoaoAnt/. **Based on:** the approach of the Dataquest. **The ipybn can be found in:** the Github in the WaddlePortfolio/Projects. # Introduction...
github_jupyter
## Columbia University ### ECBM E4040 Neural Networks and Deep Learning. Fall 2021. # ECBM E4040 - Assignment 2 - Task 3: Convolutional Neural Network (CNN) In this task, you are going to first practice the forward/backward propagation of the convolutional operations with NumPy. After that, we will introduce TensorFl...
github_jupyter
# Python Primer: The Basics This is a notebook file. It is an interactive document that you can edit on the fly, and you can use it to write and execute programs. You can learn more about the interface by reading the [online documentation](http://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Notebook%20B...
github_jupyter
<a href="https://colab.research.google.com/github/Data-Science-and-Data-Analytics-Courses/MITx---Machine-Learning-with-Python-From-Linear-Models-to-Deep-Learning-Jun-11-2019/blob/master/Resources.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Res...
github_jupyter
% CGRtools Tutorial % Dr. Ramil Nugmanov; Dr. Timur Madzhidov; Ravil Mukhametgaleev % Mar 25, 2019 # 1. Data types and operations with them (c) 2019, Dr. Ramil Nugmanov; Dr. Timur Madzhidov; Ravil Mukhametgaleev Installation instructions of CGRtools package information and tutorial's files see on `https://github.com...
github_jupyter
##### Copyright 2018 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
## Multi-label classification ``` %reload_ext autoreload %autoreload 2 %matplotlib inline from fastai.conv_learner import * PATH = 'data/planet-understanding-the-amazon-from-space/' # Data preparation steps if you are using Crestle: #os.makedirs('data/planet/models', exist_ok=True) #os.makedirs('/cache/planet/tmp', e...
github_jupyter
``` from tools import * from models import * import plotly.graph_objects as go import plotly.figure_factory as ff from Bio.SeqUtils import GC import pickle import warnings warnings.filterwarnings('ignore') #CONSTANTS AND HYPERPARAMETERS (add to yaml) # Device configuration device = torch.device('cuda:0' if torch.cuda....
github_jupyter
``` #all necessary imports to run SAMUROI %matplotlib qt4 import numpy import scipy.signal import matplotlib.pyplot as plt import samuroi from samuroi.plugins.baseline import bandstop, power_spectrum from samuroi.plugins.baseline import linbleeched_deltaF from samuroi.plugins.baseline import stdv_deltaF from samu...
github_jupyter
``` ! pip install memory_profiler %load_ext memory_profiler ``` ### INTRODUCTORY EXAMPLE: #### Total size of folders and files in a path ``` import os """ The os functions that we are given are: os.path.getsize(path) os.path.isdir(path) os.listdir(path) os.path.join(path, filename) """ def disk_usage(path): """ ...
github_jupyter
``` import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.linear_model import LinearRegression from sklearn.preprocessing import StandardScaler import statsmodels.api as sm from statsmodels.sandbox.regression.predstd import wls_prediction_std from statsmode...
github_jupyter
# Vocabulary Here are some examples and tests with vocabularies in spacy ## Matchers This is analog to traditional regular expressions but applied to documents. ``` import spacy from spacy.matcher import Matcher nlp = spacy.load("en_core_web_sm") matcher = Matcher(nlp.vocab) # work with the normal vocabulary # Sola...
github_jupyter
# Baesyan Data Analysis Course - Chapter 4 Exercises https://github.com/avehtari/BDA_course_Aalto/tree/master/exercises ### Exercise 1 - Bioassay Model In this exercise, you will use a dose-response relation model that is used in Section 3.7 of the course book and in the chapter reading instructions [here](https://gi...
github_jupyter
# Naive Bayes, Part 3 ### Naive Bayes by Example 3 In part 2, you have seen an example of Naive Bayes classifier for rain prediction. It has three input features. Now let's start with a new example. In this example, we want to build an intelligent lighting. The light has two states either 'On' or 'Off' depending on us...
github_jupyter
## MonteCarlo Apply Monte-Carlo control to Easy21. Initialise the value function to zero. Use a time-varying scalar step-size of alpha_t = 1/N(s_t, a_t) and an epsilon-greedy exploration strategy with epsilon_t = N_0 / (N_0 + N(s_t)), where N_0 = 100 is a constant, N(s) is the number of times that state s has been vis...
github_jupyter
``` import numpy as np import pandas as pd import csv import json from sklearn import preprocessing ``` #### Read csv data into a pandas dataframe ``` aid = pd.read_csv('aiddata-countries-only.csv', delimiter=',') aid aid.count() aid.columns ``` #### Group by donor and recipient respectively ``` # donor = aid.group...
github_jupyter
<a href="https://colab.research.google.com/github/sarthakpant772/ML_classification_Hacktoberfest/blob/main/King_Rook_vs_King_Pawn.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # K-Nearest-Neighbors (KNN) ## Importing Libraries ``` import tensor...
github_jupyter
# Environment ``` # setting the random seed for reproducibility import random random.seed(493) # for manipulating dataframes import pandas as pd import numpy as np # for statistical testing from scipy import stats from scipy.stats import mannwhitneyu # natural language processing import re import unicodedata import...
github_jupyter
**INITIALIZATION:** - I use these three lines of code on top of my each notebooks because it will help to prevent any problems while reloading the same project. And the third line of code helps to make visualization within the notebook. ``` #@ INITIALIZATION: %reload_ext autoreload %autoreload 2 %matplotlib inline ```...
github_jupyter
# Week 1: Mean/Covariance of a data set and effect of a linear transformation In this week, we are going to investigate how the mean and (co)variance of a dataset changes when we apply affine transformation to the dataset. ## Learning objectives 1. Get Farmiliar with basic programming using Python and Numpy/Scipy. 2....
github_jupyter
## Variance between Infomap Runs In this notebook, we check the robustness of our results against the randomness inherent in the `infomap` algorithm as reported in the SI. In short, we investigate the question: How much variance does there exist between infomap runs with different seeds? ### Preparations ``` from c...
github_jupyter
## PS2-1 Convexity of Generalized Linear Models #### (a) Output: ``` ==== Training model on data set A ==== Finished 10000 iterations Finished 20000 iterations Finished 30000 iterations Converged in 30395 iterations ==== Training model on data set B ==== Finished 10000 iterations Finished 20000 iterations Finished 3...
github_jupyter
**This code was adapted from [Alexander Held's "Example of a differentiable analysis" repository](https://github.com/alexander-held/differentiable-analysis-example/)** ``` from jax import grad, vmap, jit import jax.numpy as jnp import matplotlib.pyplot as plt import numpy as np np.random.seed(0) plt.rcParams.update( ...
github_jupyter
# codecentric.AI Bootcamp - Random Forests ## Aufgaben Hier findet ihr eine Reihe von Übungsaufgaben zu Random Forests. Folge den Aufgaben und ergänze die ___ in den Code-Abschnitten. Die folgenden Pakete werden geladen: ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline ...
github_jupyter
# Plagiarism Detection, Feature Engineering In this project, you will be tasked with building a plagiarism detector that examines an answer text file and performs binary classification; labeling that file as either plagiarized or not, depending on how similar that text file is to a provided, source text. Your first ...
github_jupyter
# Tensor Transformations ``` from __future__ import print_function import tensorflow as tf import numpy as np from datetime import date date.today() author = "kyubyong. https://github.com/Kyubyong/tensorflow-exercises" tf.__version__ np.__version__ sess = tf.InteractiveSession() ``` NOTE on notation * _x, _y, _z, ......
github_jupyter
<a href="https://colab.research.google.com/github/Priyam145/MLprojects/blob/main/notebooks/Statistics.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import seaborn as sns import numpy as np import matplotlib.pyplot as plt np.random.seed = 42 n...
github_jupyter