code
stringlengths
2.5k
150k
kind
stringclasses
1 value
# Using Transfer Learning to Classify Flower Images with PyTorch In this blog post, I will detail my repository that performs object classification with transfer learning. The project is broken down into multiple steps: * Load and preprocess the image dataset * Train the image classifier on your dataset * Use the tr...
github_jupyter
``` # Import libraries import sklearn from sklearn import model_selection import numpy as np np.random.seed(42) import os import pandas as pd %matplotlib inline import matplotlib as mpl import matplotlib.pyplot as plt # Ignore useless warnings (see SciPy issue #5998) import warnings warnings.filterwarnings(action...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import pandas as pd import numpy as np import seaborn as sns; sns.set() trips = pd.read_csv('2015_trip_data.csv', parse_dates=['starttime', 'stoptime'], infer_datetime_format=True) ind = pd.DatetimeIndex(trips.starttime) trip...
github_jupyter
# T81-558: Applications of Deep Neural Networks **Module 13: Advanced/Other Topics** * Instructor: [Jeff Heaton](https://sites.wustl.edu/jeffheaton/), McKelvey School of Engineering, [Washington University in St. Louis](https://engineering.wustl.edu/Programs/Pages/default.aspx) * For more information visit the [class w...
github_jupyter
``` %%html <style> body { font-family: "Cambria", cursive, sans-serif; } </style> import random, time import numpy as np from collections import defaultdict import operator import matplotlib.pyplot as plt ``` ## Misc functions and utilities ``` orientations = EAST, NORTH, WEST, SOUTH = [(1, 0), (0, 1), (-1, 0), (...
github_jupyter
``` library('magrittr') library('dplyr') library('tidyr') library('readr') library('ggplot2') flow_data <- read_tsv( 'data.tsv', col_types=cols( `Donor`=col_factor(levels=c('Donor 25', 'Donor 34', 'Donor 35', 'Donor 40', 'Donor 41')), `Condition`=col_factor(levels=c('No elect...
github_jupyter
# Proyecto ## Instrucciones 1.- Completa los datos personales (nombre y rol USM) de cada integrante en siguiente celda. * __Nombre-Rol__: * Cristobal Salazar 201669515-k * Andres Riveros 201710505-4 * Matias Sasso 201704523-k * Javier Valladares 201710508-9 2.- Debes _pushear_ este archivo con tus cambios a tu...
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
### An Auto correct system is an application that changes mispelled words into the correct ones. ``` # In this notebook I'll show how to implement an Auto Correct System that its very usefull. # This auto correct system only search for spelling erros, not contextual errors. ``` *The implementation can be divided in...
github_jupyter
## Birthday Paradox In a group of 5 people, how likely is it that everyone has a unique birthday (assuming that nobody was born on February 29th of a leap year)? You may feel it is highly likely because there are $365$ days in a year and loosely speaking, $365$ is "much greater" than $5$. Indeed, as you shall see, thi...
github_jupyter
# Train a basic TensorFlow Lite for Microcontrollers model This notebook demonstrates the process of training a 2.5 kB model using TensorFlow and converting it for use with TensorFlow Lite for Microcontrollers. Deep learning networks learn to model patterns in underlying data. Here, we're going to train a network to...
github_jupyter
# pywikipathways and bridgedbpy [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/kozo2/pywikipathways/blob/main/docs/pywikipathways-and-bridgedbpy.ipynb) by Kozo Nishida and Alexander Pico pywikipathways 0.0.2 bridgedbpy 0.0.2 *WikiPathways* is a...
github_jupyter
``` # default_exp trainer ``` # Trainer > Implementation of torch-based model trainers. ``` #hide from nbdev.showdoc import * from fastcore.nb_imports import * from fastcore.test import * ``` ## PL Trainer > Implementation of trainer for training PyTorch Lightning models. ``` #export from typing import Any, Iterabl...
github_jupyter
## Conceptual description As people interact, they tend to become more alike in their beliefs, attitudes and behaviour. In "The Dissemination of Culture: A Model with Local Convergence and Global Polarization" (1997), Robert Axelrod presents an agent-based model to explain cultural diffusion. Analogous to Schelling's ...
github_jupyter
# SUPERVISED MACHINE LEARNING (LINEAR REGRESSION) ## Author-Neeraj Lalwani ### Importing important libraries ``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline ``` ### Importing dataset ``` Data = pd.read_csv("marks.csv") print("Data is successfully ...
github_jupyter
## Imports ``` import numpy as np import matplotlib.pyplot as plt %tensorflow_version 2.x import tensorflow as tf from tensorflow import keras from keras.models import Sequential, Model from keras.layers import Flatten, Dense, LSTM, GRU, SimpleRNN, RepeatVector, Input from keras import backend as K from keras.utils.vi...
github_jupyter
``` import numpy as np import pandas as pd import xgboost as xgb from xgboost.sklearn import XGBClassifier from sklearn import preprocessing from sklearn.preprocessing import OneHotEncoder from sklearn.grid_search import GridSearchCV, RandomizedSearchCV from sklearn.datasets import make_classification from sklearn.cro...
github_jupyter
``` %matplotlib inline import numpy as np import statsmodels.api as sm import pandas as pd import matplotlib.pyplot as plt import seaborn as sn plt.style.use('seaborn-whitegrid') plt.rcParams["font.family"] = "Times New Roman" plt.rcParams["font.size"] = "17" ``` * Get the dataset from the Stata Press publishing hous...
github_jupyter
# HRF downsampling This short notebook is why (often) we have to downsample our predictors after convolution with an HRF. ``` import numpy as np import seaborn as sns import matplotlib.pyplot as plt from nistats.hemodynamic_models import glover_hrf %matplotlib inline ``` First, let's define our data. Suppose we did a...
github_jupyter
# Table of Contents <p><div class="lev1 toc-item"><a href="#Linear-Regression-problem" data-toc-modified-id="Linear-Regression-problem-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Linear Regression problem</a></div><div class="lev1 toc-item"><a href="#Gradient-Descent" data-toc-modified-id="Gradient-Descent-2"><s...
github_jupyter
``` import cv2 import numpy as np import pandas as pd import numba import matplotlib.pyplot as plt from scipy.optimize import curve_fit import matplotlib model = 'neural' symmetric = False nPosts = 3 if symmetric == True: data = 'SPP/symmetric_n' if model == 'collective' else 'NN/symmetric_n' prefix = 'coll_s...
github_jupyter
# Matrix Factorization Matrix Factorization :cite:`Koren.Bell.Volinsky.2009` is a well-established algorithm in the recommender systems literature. The first version of matrix factorization model is proposed by Simon Funk in a famous [blog post](https://sifter.org/~simon/journal/20061211.html) in which he described th...
github_jupyter
<h1 align="center"> TUGAS BESAR TF3101 - DINAMIKA SISTEM DAN SIMULASI </h1> <h2 align="center"> Sistem Elektrik, Elektromekanik, dan Mekanik</h2> <h3>Nama Anggota:</h3> <body> <ul> <li>Erlant Muhammad Khalfani (13317025)</li> <li>Bernardus Rendy (13317041)</li> </ul> </body> ## 1. Pemodelan Si...
github_jupyter
``` # Dependencies and Setup import pandas as pd # File to Load school_data_to_load = "Resources/schools_complete.csv" student_data_to_load = "Resources/students_complete.csv" # Read School and Student Data File and store into Pandas Data Frames school_data = pd.read_csv(school_data_to_load) student_data = pd.read_c...
github_jupyter
# Convolution_with_fastai > 2021-10-26 - toc: true - badges: true - comments: false - categories: bigdata - image: images/chart-preview.png - hide: true ``` import torch from fastai.vision.all import * ``` #### data ``` path = untar_data(URLs.MNIST_SAMPLE) path.ls() ``` `-` list 형태로 목록 받기 ``` threes = (path/'tra...
github_jupyter
# Game Music dataset: data cleaning and exploration The goal with this notebook is cleaning the dataset to make it usable as well as providing a descriptive analysis of the dataset features. ## Data loading and cleaning ``` import warnings warnings.filterwarnings('ignore') import pandas as pd import numpy as np from ...
github_jupyter
# Convolutional Neural Network in Keras Bulding a Convolutional Neural Network to classify Fashion-MNIST. #### Set seed for reproducibility ``` import numpy as np np.random.seed(42) ``` #### Load dependencies ``` import os from tensorflow.keras.datasets import fashion_mnist from tensorflow.keras.models import Seq...
github_jupyter
``` import json import requests import numpy as np import os import shutil #Get google api keys with open("../config.json", "r") as f: # k = json.load(f)['key_bsa'] # bk = json.load(f)['big_key_demo'] kk = json.load(f)['key_kaitlin'] BASE_URL_DIRECTIONS = 'https://maps.googleapis.com/maps/api/directions/jso...
github_jupyter
# Parallel GST using MPI The purpose of this tutorial is to demonstrate how to compute GST estimates in parallel (using multiple CPUs or "processors"). The core PyGSTi computational routines are written to take advantage of multiple processors via the MPI communication framework, and so one must have a version of MPI ...
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/automated-machine-learning/forecasting-bike-share/auto-ml-forecasting-bike-share.png) # Automated Ma...
github_jupyter
``` import numpy as np # type: ignore import onnx import onnx.helper as h import onnx.checker as checker from onnx import TensorProto as tp from onnx import save import onnxruntime # Builds a pipeline that resizes and crops an input. def build_preprocessing_model(filename): nodes = [] nodes.append( ...
github_jupyter
# Plot General/Specific results ## Functions ``` %run -i 'arena.py' %matplotlib inline %matplotlib notebook import matplotlib from matplotlib import pyplot as plt def plotDataFromFile(file, saveDir, style, label, color, fullRuns, linewidth, ax): x = [i for i in range(9)] if fullRuns: data = load_obj(...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import scipy df= pd.read_csv('train_ctrUa4K.csv') df.head() income_pop= df.ApplicantIncome income_pop.shape ``` Let's have a look at the stats of Population (*ApplicantIncome*). ``` # mean mean_pop=income_pop.mean() mean_...
github_jupyter
# Getting Started with BentoML [BentoML](http://bentoml.ai) is an open-source framework for machine learning **model serving**, aiming to **bridge the gap between Data Science and DevOps**. Data Scientists can easily package their models trained with any ML framework using BentoMl and reproduce the model for serving ...
github_jupyter
<a href="https://colab.research.google.com/github/WISSAL-MN/House-Price-Prediction-/blob/main/House_Price_Prediction.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import se...
github_jupyter
# Time Complexity Examples ``` def logarithmic_problem(N): i = N while i > 1: # do something i = i // 2 # move on %time logarithmic_problem(10000) def linear_problem(N): i = N while i > 1: # do something i = i - 1 # move on %time linear_problem(10000) def...
github_jupyter
# Pathlib ## Object oriented Pythonic paths aka "The Right Way to do Paths" https://docs.python.org/3/library/pathlib.html ``` # Pathlib is a standard Python library # You will usually want to import Path and/or PurePath import pathlib from pathlib import Path, PurePath # Let's do a few more imports for later impor...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import pandas as pd %matplotlib inline #defining sigmoid function def sigmoid(x): return 1/(1 + np.exp(-x)) #ploting sigmoid fuction for the values -7,7 z = np.arange(-7,7,0.1) phi_z = sigmoid(z) plt.plot(z,phi_z) plt.axvline(0.0, color ='k') plt.xlabel("z") pl...
github_jupyter
Ensembling different models ``` from google.cloud import storage from io import BytesIO client = storage.Client() storage_client = storage.Client(project = 'irkml1') bucket = storage_client.get_bucket("aindstorm_bucket") blob1 = storage.blob.Blob("train_3lags_semibalanced.csv",bucket) content1 = blob1.download_as_str...
github_jupyter
# Differentially Private Covariance SmartNoise offers three different functionalities within its `covariance` function: 1. Covariance between two vectors 2. Covariance matrix of a matrix 3. Cross-covariance matrix of a pair of matrices, where element $(i,j)$ of the returned matrix is the covariance of column $i$ of t...
github_jupyter
<a href="https://colab.research.google.com/github/mashyko/object_detection/blob/master/Model_Quickload.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #Tutorials Installation: https://caffe2.ai/docs/tutorials.html First download the tutorials sourc...
github_jupyter
<table border="0"> <tr> <td> <img src="https://ictd2016.files.wordpress.com/2016/04/microsoft-research-logo-copy.jpg" style="width 30px;" /> </td> <td> <img src="https://www.microsoft.com/en-us/research/wp-content/uploads/2016/12/MSR-ALICE-HeaderGraphic-1920x720_...
github_jupyter
### 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. ``` # Dependencies and Setup import pandas as pd # File to Load (Remember to Change These) file_to_load = "Resources/purchase_data.csv" # Read Purchasing Fil...
github_jupyter
``` # default_exp models.cox ``` # Cox Proportional Hazard > SA with features apart from time We model the the instantaneous hazard as the product of two functions, one with the time component, and the other with the feature component. $$ \begin{aligned} \lambda(t,x) = \lambda(t)h(x) \end{aligned} $$ It is important...
github_jupyter
(*** hide ***) ``` #nowarn "211" open System let airQuality = __SOURCE_DIRECTORY__ + "/data/airquality.csv" ``` (** Interoperating between R and Deedle =================================== The [R type provider](http://fslab.org/RProvider/) enables smooth interoperation between R and F#. The type provider automatica...
github_jupyter
# FloPy ## Creating a Simple MODFLOW 6 Model with Flopy The purpose of this notebook is to demonstrate the Flopy capabilities for building a simple MODFLOW 6 model from scratch, running the model, and viewing the results. This notebook will demonstrate the capabilities using a simple lake example. A separate notebo...
github_jupyter
As a self-taught Data Scientist and programmer, I always get asked about how I started my path towards learning, and a lot of non-coders ask me about how they can learn more about Data Science. And while I tell them about the umpteen Data Analytics and Data Visualization tools, various Machine Learning algorithms, and ...
github_jupyter
## Sentiment Classification AU Reviews Data (BOW, non-Deep Learning) This notebook covers two good approaches to perform sentiment classification - Naive Bayes and Logistic Regression. We will train AU reviews data on both. As a rule of thumb, reviews that are 3 stars and above are **positive**, and vice versa. ``` ...
github_jupyter
# A Whale off the Port(folio) --- In this assignment, you'll get to use what you've learned this week to evaluate the performance among various algorithmic, hedge, and mutual fund portfolios and compare them against the S&P TSX 60 Index. ## Assumptions and limitations 1. Limitation: Only dates that overlap betwe...
github_jupyter
``` from gs_quant.session import GsSession, Environment from gs_quant.instrument import IRSwap from gs_quant.risk import IRFwdRate, CarryScenario from gs_quant.markets.portfolio import Portfolio from gs_quant.markets import PricingContext from datetime import datetime import matplotlib.pylab as plt import pandas as pd ...
github_jupyter
``` # Initialize Otter import otter grader = otter.Notebook("hw09.ipynb") ``` # Homework 9: Bootstrap, Resampling, CLT **Reading**: * [Estimation](https://www.inferentialthinking.com/chapters/13/estimation.html) * [Why the mean matters](https://www.inferentialthinking.com/chapters/14/why-the-mean-matters.html) Plea...
github_jupyter
``` # import Modules import numpy as np from stl import mesh import matplotlib.pyplot as plt %matplotlib widget # import stl file part_mesh = mesh.Mesh.from_file('3DBenchy.stl') print("File loaded in as faces and vertices") # Slice STL file at each z value and return a # pair of points that def STL_Slicer(stl_mesh,...
github_jupyter
>This notebook is part of our [Introduction to Machine Learning](http://www.codeheroku.com/course?course_id=1) course at [Code Heroku](http://www.codeheroku.com/). Hey folks, today we are going to discuss about the application of gradient descent algorithm for solving machine learning problems. Let’s take a brief over...
github_jupyter
``` import csv import itertools import operator import numpy as np import nltk import sys from datetime import datetime from utils import * import matplotlib.pyplot as plt %matplotlib inline vocabulary_size = 200 sentence_start_token = "START" sentence_end_token = "END" f = open('data/ratings_train.txt', 'r') lines = ...
github_jupyter
**Chapter 10 – Introduction to Artificial Neural Networks with Keras** _This notebook contains all the sample code and solutions to the exercises in chapter 10._ # Setup First, let's import a few common modules, ensure MatplotLib plots figures inline and prepare a function to save the figures. We also check that Pyt...
github_jupyter
``` import math import pandas as pd from langdetect import detect import numpy as np import nltk from nltk.stem import WordNetLemmatizer import string from sklearn.feature_extraction.text import CountVectorizer import math import matplotlib.pyplot as plt lem = WordNetLemmatizer() #create lemmatizer import ssl try: ...
github_jupyter
## title ``` (define (constant value connector) (define (me request) (error "Unknow request -- CONSTANT" request)) (connect connector me) (set-value! connector value me) me) (define (probe name connector) (define (print-probe value) (newline) (display "Probe: ") (display name) (display "...
github_jupyter
# Dateien ## Eine Textdatei lesen und ihren Inhalt ausgeben ``` # Wir öffnen die Datei lesen.txt zum Lesen ("r") und speichern ihren Inhalt in die Variable file file = open("lesen.txt", "r") # Wir gehen alle Zeilen nacheinander durch # In der txt-Datei stehen für uns nicht sichtbare Zeilenumbruchszeichen, durch die ...
github_jupyter
Lambda School Data Science *Unit 2, Sprint 3, Module 3* --- # Permutation & Boosting - Get **permutation importances** for model interpretation and feature selection - Use xgboost for **gradient boosting** ### Setup Run the code cell below. You can work locally (follow the [local setup instructions](https://lambd...
github_jupyter
# Import Libraries ``` import numpy as np import pandas as pd ``` # Import Data ``` # Import data. loan_data_preprocessed_backup = pd.read_csv('loan_data_2007_2014_preprocessed.csv') ``` # Explore Data ``` loan_data_preprocessed = loan_data_preprocessed_backup.copy() loan_data_preprocessed.columns.values # Display...
github_jupyter
# Principal Component Analysis (PCA) in Python # Killian McKee ### Overview ### 1. [What is PCA?](#section1) 2. [Key Terms](#section2) 3. [Pros and Cons of PCA](#section3) 4. [When to use PCA](#section4) 5. [Key Parameters](#section5) 6. [Walkthrough: PCA for data visualization](#section6) 7. [Walkthrough: PCA w/ R...
github_jupyter
``` from libraries.import_export_data_objects import import_export_data as Import_Export_Data from libraries.altair_renderings import AltairRenderings from libraries.utility import Utility import os import altair as alt my_altair = AltairRenderings() from IPython.core.display import display, HTML display(HTML( '<st...
github_jupyter
# Face Generation In this project, you'll define and train a DCGAN on a dataset of faces. Your goal is to get a generator network to generate *new* images of faces that look as realistic as possible! The project will be broken down into a series of tasks from **loading in data to defining and training adversarial net...
github_jupyter
Copyright 2021 DeepMind Technologies Limited 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 agreed to in writi...
github_jupyter
# Coverage of MultiPLIER LV The goal of this notebook is to examine why genes were found to be generic. Specifically, this notebook is trying to answer the question: Are generic genes found in more multiplier latent variables compared to specific genes? The PLIER model performs a matrix factorization of gene expressi...
github_jupyter
``` # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load in import os import random import xgboost import lightgbm as lgb import numpy as np # l...
github_jupyter
<font size="+5">#02 | Decision Tree. A Supervised Classification Model</font> - Subscribe to my [Blog ↗](https://blog.pythonassembly.com/) - Let's keep in touch on [LinkedIn ↗](www.linkedin.com/in/jsulopz) 😄 # Discipline to Search Solutions in Google > Apply the following steps when **looking for solutions in Googl...
github_jupyter
# CRRT Mortality Prediction ## Model Construction ### Christopher V. Cosgriff, David Sasson, Colby Wilkinson, Kanhua Yin The purpose of this notebook is to build a deep learning model that predicts ICU mortality in the CRRT population. The data is extracted in the `extract_cohort_and_features` notebook and stored in ...
github_jupyter
# $\color{black}{}$ ### 1. Fitting data --- ### Input data ``` import pandas as pd import seaborn as sns data = pd.read_csv('https://milliams.com/courses/applied_data_analysis/linear.csv') data.head() ``` Let's check how many rows we have ``` data.count() ``` We have 50 rows here. In the input data, each row is o...
github_jupyter
``` # Mount Google Drive from google.colab import drive # import drive from google colab ROOT = "/content/drive" # default location for the drive print(ROOT) # print content of ROOT (Optional) drive.mount(ROOT) # we mount the google drive at /content/drive !pip install pennylane from I...
github_jupyter
``` import numpy as np np.seterr(divide='ignore', invalid='ignore') import scipy.integrate as integrate from scipy.special import gamma # Characteristic function of the Lifted Heston model see Slides 85-87 def Ch_Lifted_Heston(omega,S0,T,rho,lamb,theta,nu,V0,N,rN,alpha,M): # omega = argument of the ch. function ...
github_jupyter
``` #Write a Python programming to create a pie chart of the popularity of programming Languages. import matplotlib.pyplot as plt import numpy as np import pandas as pd plt.figure(figsize=(8,8)) languages=['Java', 'Python', 'PHP', 'JavaScript','c#','c++'] Popularity=[22.2, 17.6, 8.8, 8, 7.7, 6.7] plt.pie(Popularity,la...
github_jupyter
``` import pandas as pd import numpy as np import stellargraph as sg from stellargraph.mapper import PaddedGraphGenerator from stellargraph.layer import DeepGraphCNN from stellargraph import StellarGraph from stellargraph import datasets from sklearn import model_selection from IPython.display import display, HTML ...
github_jupyter
``` import logging import torch import torch.optim as optim import torch.nn as nn import torch.nn.functional as F import argparse import os import random import numpy as np from torch.autograd import Variable from torch.utils.data import DataLoader import utils import itertools from tqdm import tqdm_notebook import mod...
github_jupyter
# $H(curl, \Omega)$ Elliptic Problems $\newcommand{\dd}{\,{\rm d}}$ $\newcommand{\uu}{\mathbf{u}}$ $\newcommand{\vv}{\mathbf{v}}$ $\newcommand{\nn}{\mathbf{n}}$ $\newcommand{\ff}{\mathbf{f}}$ $\newcommand{\Hcurlzero}{\mathbf{H}_0(\mbox{curl}, \Omega)}$ $\newcommand{\Curl}{\nabla \times}$ Let $\Omega \subset \mathbb{R...
github_jupyter
# Emotion recognition using Emo-DB dataset and scikit-learn ### Database: Emo-DB database (free) 7 emotions The data can be downloaded from http://emodb.bilderbar.info/index-1024.html Code of emotions W->Anger->Wut L->Boredom->Langeweile E->Disgust->Ekel A->Anxiety/Fear->Angst F->Happiness->Freude T->Sadness->T...
github_jupyter
<a href="https://colab.research.google.com/github/Nikhitha-S-Pavan/Deep-learning-examples-using-keras/blob/main/Keras_mnist_digit_dataset.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` !pip install keras-tuner import tensorflow as tf from tens...
github_jupyter
# 07 - Ensemble Methods by [Alejandro Correa Bahnsen](http://www.albahnsen.com/) & [Iván Torroledo](http://www.ivantorroledo.com/) version 1.3, June 2018 ## Part of the class [Applied Deep Learning](https://github.com/albahnsen/AppliedDeepLearningClass) This notebook is licensed under a [Creative Commons Attributi...
github_jupyter
``` import os for dirname, _, filenames in os.walk('../input/covid19-image-dataset'): for filename in filenames: print(os.path.join(dirname, filename)) import tensorflow as tf import numpy as np import os from matplotlib import pyplot as plt import cv2 from tensorflow import keras from keras.models import ...
github_jupyter
# Collaborative filtering on Google Analytics data This notebook demonstrates how to implement a WALS matrix refactorization approach to do collaborative filtering. ``` import os PROJECT = "cloud-training-demos" # REPLACE WITH YOUR PROJECT ID BUCKET = "cloud-training-demos-ml" # REPLACE WITH YOUR BUCKET NAME REGION =...
github_jupyter
<!--BOOK_INFORMATION--> <img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png"> *This notebook contains an excerpt from the [Python Data Science Handbook](http://shop.oreilly.com/product/0636920034919.do) by Jake VanderPlas; the content is available [on GitHub](https://github.com/jakevdp/Pyth...
github_jupyter
## Building a Stack in Python Before we start let us reiterate they key components of a stack. A stack is a data structure that consists of two main operations: push and pop. A push is when you add an element to the **top of the stack** and a pop is when you remove an element from **the top of the stack**. Python 3.x ...
github_jupyter
``` # hide %load_ext nb_black # nb_black if using jupyter ``` # Helsinki Machine Learning Project Template Template for open source ML and predictive analytics projects. ![Python version](https://img.shields.io/badge/python-3.8-blue) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.sv...
github_jupyter
## Install the packages ``` !pip install -Uqq datasets pythainlp==2.2.4 transformers==4.4.0 tensorflow==2.4.0 tensorflow_text emoji seqeval sentencepiece fuzzywuzzy !npx degit --force https://github.com/vistec-AI/thai2transformers#dev %load_ext autoreload %autoreload 2 import pythainlp, transformers pythainlp.__versi...
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"); # 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
# How to make the perfect time-lapse of the Earth This tutorial shows a detail coverage of making time-lapse animations from satellite imagery like a pro. <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#0.-Prerequisites" data-toc-modified-id="0.-Prere...
github_jupyter
``` %load_ext autoreload %autoreload 2| import os import pickle from utils.config import * event = 'thread' file = os.path.join(SANDY_ATTR_PATH, f'corpus.{event}.pkl') corpus = pickle.load(open(file, "rb" )) attr = pickle.load(open(os.path.join(SANDY_ATTR_PATH, f'attr.{event}.pkl'), "rb" )) targets = attr['target_arr...
github_jupyter
##### 训练PNet ``` #导入公共文件 import os import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torchvision import torchvision.transforms as transforms from torch.autograd import Variable import sys sys.path.append('../') # add other package import numpy as np import pandas a...
github_jupyter
## Segmenting and Clustering Neighborhoods in Toronto In this project we explore, segment, and cluster the neighborhoods in the city of Toronto. Since the data is not available in the Internet on a simple presentation, we have to scrape a Wikipedia page wrangle the data, clean it, and then read it into a structured ...
github_jupyter
``` import numpy as np import pandas as pd import os import gc import seaborn as sns # for plotting graphs import matplotlib.pyplot as plt # for plotting graphs aswell import glob from datetime import datetime from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifie...
github_jupyter
``` import sys import os project_root = os.path.abspath("../..") # project_root = os.path.abspath(os.path.join(script_path, "../..")) if project_root not in sys.path: sys.path.append(project_root) print(f"Project_root: {project_root}") import pandas as pd from analysis.utils.constants import stats_2021_path,...
github_jupyter
``` # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O...
github_jupyter
``` from splinter import Browser from bs4 import BeautifulSoup as bs import pymongo import time import pandas as pd conn = 'mongodb://localhost:27017' client = pymongo.MongoClient(conn) db = client.mars_db collection = db.titles executable_path = {"executable_path":"C:/Users/cgrinstead12/Desktop/Mission to Mars/chromed...
github_jupyter
``` # Initialize Otter import otter grader = otter.Notebook("lab04.ipynb") ``` # Lab 4: Functions and Visualizations Welcome to Lab 4! This week, we'll learn about functions, table methods such as `apply`, and how to generate visualizations! Recommended Reading: * [Applying a Function to a Column](https://www.infe...
github_jupyter
``` import sys from PyQt5 import QtCore, QtWidgets, QtWebEngineWidgets from lxml import html as htmlRenderer import requests import json from datetime import date, datetime, timedelta def render(source_url): """Fully render HTML, JavaScript and all.""" import sys from PyQt5.QtWidgets import QApplication ...
github_jupyter
``` import math import json import pandas as pd import numpy as np from Bio import SeqIO from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord import matplotlib.pyplot as plt import seaborn as sns from scipy import stats #make test data set to sanity check outgroup_test = ['ATGGAGATT'] test_seqs = ['ATGGAGATT', '...
github_jupyter
``` %matplotlib inline ``` # Wasserstein 1D with PyTorch In this small example, we consider the following minization problem: \begin{align}\mu^* = \min_\mu W(\mu,\nu)\end{align} where $\nu$ is a reference 1D measure. The problem is handled by a projected gradient descent method, where the gradient is computed by p...
github_jupyter
``` from github import Github import tqdm # First create a Github instance: g = Github("5c103d46120d27b0fac5d9d1b9df0b91c77c5d42") org = g.get_organization("applied-ml-spring-18") repos = org.get_repos() repos_list = list(repos) hw4 = [repo for repo in repos_list if "homework-4" in repo.full_name] import os os.chdir("...
github_jupyter
``` %run ../common-imports.ipynb ``` # Tidy Data with Pandas ``` # Reading the csv files into a pandas data frame temperature = pd.read_csv("../../datasets/temperature.csv") humidity = pd.read_csv("../../datasets/humidity.csv") wind_speed = pd.read_csv("../../datasets/wind_speed.csv") temperature.head() # Importi...
github_jupyter
``` import pandas as pd import matplotlib import matplotlib.pyplot as plt import numpy as np; np.random.seed(0) import seaborn as sns data = pd.read_csv("avocado.csv") pd.set_option('display.max_rows', 100) print(data) data.head() data.tail() #BoxPlot_Avocado columna_1 = data["Small Bags"] columna_2 = data["Large Bag...
github_jupyter