text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# LinearSVR with MinMaxScaler & Power Transformer This Code template is for the Classification task using Support Vector Regressor (SVR) based on the Support Vector Machine algorithm with Power Transformer as Feature Transformation Technique and MinMaxScaler for Feature Scaling in a pipeline. ### Required Packages ...
github_jupyter
<img src="../images/26-weeks-of-data-science-banner.jpg"/> # Getting Started with Python ## About Python <img src="../images/python-logo.png" alt="Python" style="width: 500px;"/> Python is a - general purpose programming language - interpreted, not compiled - both **dynamically typed** _and_ **strongly typed** -...
github_jupyter
#Instalamos pytorch ``` #pip install torch===1.6.0 torchvision===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html ``` #Clonamos el repositorio para obtener el dataset ``` !git clone https://github.com/joanby/deeplearning-az.git from google.colab import drive drive.mount('/content/drive') ``` # Importar l...
github_jupyter
# NLP Intent Recognition Hallo und herzlich willkommen zum codecentric.AI bootcamp! Heute wollen wir uns mit einem fortgeschrittenen Thema aus dem Bereich _natural language processing_, kurz _NLP_, genannt, beschäftigen: > Wie bringt man Sprachassistenten, Chatbots und ähnlichen Systemen bei, die Absicht eines Nutze...
github_jupyter
Copyright 2018 Google Inc. 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 writing, software distribut...
github_jupyter
# Lab 2: networkX Drawing and Network Properties ``` import matplotlib.pyplot as plt import pandas as pd from networkx import nx ``` ## TOC 1. [Q1](#Q1) 2. [Q2](#Q2) 3. [Q3](#Q3) 4. [Q4](#Q4) ``` fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(11, 8)) ax = axes.flatten() path = nx.path_graph(5) nx.draw_networkx...
github_jupyter
# Lesson 1 Experiments This section just reproduces lesson 1 logic using my own code and with 30 tennis and 30 basketball player images. I chose all male players for simplicity. ``` # Put these at the top of every notebook, to get automatic reloading and inline plotting %reload_ext autoreload %autoreload 2 %matplotlib...
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
# Tutorial In this notebook, we will see how to pass your own encoder and decoder's architectures to your VAE model using pythae! ``` # If you run on colab uncomment the following line #!pip install git+https://github.com/clementchadebec/benchmark_VAE.git import torch import torchvision.datasets as datasets import ma...
github_jupyter
# Chapter 3 : pandas ``` #load watermark %load_ext watermark %watermark -a 'Gopala KR' -u -d -v -p watermark,numpy,pandas,matplotlib,nltk,sklearn,tensorflow,theano,mxnet,chainer,seaborn,keras,tflearn,bokeh,gensim ``` # pandas DataFrames ``` import numpy as np import scipy as sp import pandas as pd ``` ## Load the d...
github_jupyter
``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt from ttim import * ``` ### Theis ``` from scipy.special import exp1 def theis(r, t, T, S, Q): u = r ** 2 * S / (4 * T * t) h = -Q / (4 * np.pi * T) * exp1(u) return h def theisQr(r, t, T, S, Q): u = r ** 2 * S / (4 * T * t) ...
github_jupyter
``` %load_ext autoreload %autoreload 2 import argparse import sys from time import sleep import numpy as np from rdkit import Chem, DataStructs from rdkit.Chem import AllChem from rdkit.Chem.Crippen import MolLogP from sklearn.metrics import accuracy_score, mean_squared_error import torch import torch.nn as nn impo...
github_jupyter
# Control In this notebook we want to control the chaos in the Henon map. The Henon map is defined by $$ \begin{align} x_{n+1}&=1-ax_n^2+y_n\\ y_{n+1}&=bx_n \end{align}. $$ ``` from plotly import offline as py from plotly import graph_objs as go py.init_notebook_mode(connected=True) ``` ### Fixed points First we ...
github_jupyter
# Single model ``` from consav import runtools runtools.write_numba_config(disable=0,threads=4) %matplotlib inline %load_ext autoreload %autoreload 2 # Local modules from Model import RetirementClass import SimulatedMinimumDistance as SMD import figs import funs # Global modules import numpy as np import matplotlib...
github_jupyter
# CNTK 201A Part A: CIFAR-10 Data Loader This tutorial will show how to prepare image data sets for use with deep learning algorithms in CNTK. The CIFAR-10 dataset (http://www.cs.toronto.edu/~kriz/cifar.html) is a popular dataset for image classification, collected by Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. ...
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
``` #@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 agreed to in writing, software # distributed u...
github_jupyter
# MARATONA BEHIND THE CODE 2020 ## DESAFIO 2: PARTE 1 ### Introdução Em projetos de ciência de dados visando a construção de modelos de *machine learning*, ou aprendizado estatístico, é muito incomum que os dados iniciais estejam já no formato ideal para a construção de modelos. São necessários vários passos interme...
github_jupyter
``` import os import time import random import pandas as pd import numpy as np import gc import re import torch from torchtext import data import spacy from tqdm import tqdm_notebook, tnrange from tqdm.auto import tqdm from unidecode import unidecode import random tqdm.pandas(desc='Progress') from collections import C...
github_jupyter
# Discrete stochastic Erlang SEIR model Author: Lam Ha @lamhm Date: 2018-10-03 ## Calculate Discrete Erlang Probabilities The following function is to calculate the discrete truncated Erlang probability, given $k$ and $\gamma$: \begin{equation*} p_i = \frac{1}{C(n^{E})} \Bigl(\sum_{j=0}^{k-1} \frac{e^{-(i-1)\g...
github_jupyter
# <div align="center">Random Forest Classification in Python</div> --------------------------------------------------------------------- you can Find me on Github: > ###### [ GitHub](https://github.com/lev1khachatryan) <img src="asset/main.png" /> <a id="top"></a> <br> ## Notebook Content 1. [The random forests al...
github_jupyter
<a href="https://colab.research.google.com/github/zjzsu2000/CMPE297_AdvanceDL_Project/blob/main/Data_Preprocessing/Final_result.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import pandas as pd import numpy as np from google.colab import drive...
github_jupyter
``` # hide # all_tutorial ! [ -e /content ] && pip install -Uqq mrl-pypi # upgrade mrl on colab ``` # Tutorial - Conditional LSTM Language Models >Training and using conditional LSTM language models ## LSTM Language Models LSTM language models are a type of autoregressive generative model. This particular type of ...
github_jupyter
# Decisiton Tree interpretability notebook ``` import os import matplotlib.pyplot as plt import pandas as pd from sklearn.tree import plot_tree from dtreeviz.trees import * from pycaret import classification ``` ### Exploratory data analysis Import to specify correctly the data path. Initally we can make an easy exp...
github_jupyter
# OpenCV example. Show webcam image and detect face. It uses Lena's face and add random noise to it if the video capture doesn't work for some reason. https://gist.github.com/astanin/3097851 <table > <tr> <th>![Lena's picture + random noise](./images/Screenshot_2017-06-15_12-47-50.png)</th> <th>![Patrick...
github_jupyter
# Neural Nets with Keras In this notebook you will learn how to implement neural networks using the Keras API. We will use TensorFlow's own implementation, *tf.keras*, which comes bundled with TensorFlow. Don't hesitate to look at the documentation at [keras.io](https://keras.io/). All the code examples should work f...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline ``` # Numerical Integration The definite integral $\int_a^b f(x) dx$ can be computed exactly if the primitive $F$ of $f$ is known, e.g. ``` f = lambda x: np.divide(np.dot(x,np.exp(x)),np.power(x+1,2)) F = lambda x: np.divide(np.exp(x),(x+1)) ...
github_jupyter
# 012_importing_datasets [Source](https://github.com/iArunava/Python-TheNoTheoryGuide/) ``` # Required Imports import pandas as pd import sklearn as sk import sqlite3 from pandas.io import sql # Importing CSV files from local directory # NOTE: Make sure the Path you use contains the dataset named 'whereisthatdataset....
github_jupyter
``` # install composer, hiding output to keep the notebook clean ! pip install mosaicml > /dev/null 2>&1 ``` # Using the Functional API In this tutorial, we'll see an example of using Composer's algorithms in a standalone fashion with no changes to the surrounding code and no requirement to use the Composer trainer. ...
github_jupyter
``` # default_exp distributed #export from fastai.basics import * from fastai.callback.progress import ProgressCallback from torch.nn.parallel import DistributedDataParallel, DataParallel from fastai.data.load import _FakeLoader ``` # Distributed and parallel training > Callbacks and helper functions to train in para...
github_jupyter
# Description for Modules pandas-> read our csv files numpy-> convert the data to suitable form to feed into the classification data seaborn and matplotlib-> For visualizations sklearn-> To use logistic regression ``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt % mat...
github_jupyter
# sports-book-manager ## Example 1: ### Using the BookScraper class Importing the scraper class and setting the domain and directory paths. ``` import sports_book_manager.book_scrape_class as bs PointsBet = bs.BookScraper(domain=r'https://nj.pointsbet.com/sports', directorie...
github_jupyter
&emsp;&emsp;&emsp;&emsp;&emsp; &emsp;&emsp;&emsp;&emsp;&emsp; &emsp;&emsp;&emsp;&emsp;&emsp; &emsp;&emsp;&emsp;&emsp;&emsp; &emsp;&emsp;&emsp;&emsp;&emsp; &emsp;&emsp;&ensp; [Home Page](../../START_HERE.ipynb) [Previous Notebook](Challenge.ipynb) &emsp;&emsp;&emsp;&emsp;&emsp; &emsp;&emsp;&emsp;&emsp;&emsp; &emsp;&ems...
github_jupyter
# UMAP on the PBMC dataset of Zheng ``` %load_ext autoreload %autoreload 2 %env CUDA_VISIBLE_DEVICES=2 import numpy as np import pandas as pd import os import matplotlib.pyplot as plt import umap from firelight.visualizers.colorization import get_distinct_colors from matplotlib.colors import ListedColormap import pic...
github_jupyter
# Ray Crash Course - Actors © 2019-2021, Anyscale. All Rights Reserved ![Anyscale Academy](../images/AnyscaleAcademyLogo.png) Using Ray _tasks_ is great for distributing work around a cluster, but we've said nothing so far about managing distributed _state_, one of the big challenges in distributed computing. Ray ta...
github_jupyter
Before you turn this problem in, make sure everything runs as expected. First, **restart the kernel** (in the menubar, select Kernel$\rightarrow$Restart) and then **run all cells** (in the menubar, select Cell$\rightarrow$Run All). Make sure you fill in any place that says `YOUR CODE HERE` or "YOUR ANSWER HERE", as we...
github_jupyter
<a href="https://githubtocolab.com/giswqs/geemap/blob/master/examples/notebooks/57_cartoee_blend.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"/></a> Uncomment the following line to install [geemap](https://geemap.org) and [cartopy](https://scitools.org....
github_jupyter
# Using the MANN Package to convert and prune an existing TensorFlow model In this notebook, we utilize the MANN package on an existing TensorFlow model to convert existing layers to MANN layers and then prune the model. ``` # Load the MANN package and TensorFlow import tensorflow as tf import mann # Load the data (x...
github_jupyter
# Demistifying GANs in TensorFlow 2.0 ``` import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from tensorflow import keras print(tf.__version__) ``` ## Global Parameters ``` BATCH_SIZE = 256 BUFFER_SIZE = 60000 EPOCHES = 300 OUTPUT_DIR = "img" # The output directory where the images of the gen...
github_jupyter
<a href="https://colab.research.google.com/github/christianhidber/easyagents/blob/master/jupyter_notebooks/intro_cartpole.ipynb" target="_parent"> <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/> </a> # CartPole Gym environment with TfAgents ## Install packages (gym, tf...
github_jupyter
Tutorials table of content: - [Tutorial 1: Run a first scenario](./Tutorial-1_Run_your_first_scenario.ipynb) - [Tutorial 2: Add contributivity measurements methods](./Tutorial-2_Add_contributivity_measurement.ipynb) - Tutorial 3: Use a custom dataset # Tutorial 3 : Use homemade dataset With this example, we dive d...
github_jupyter
# Programming and Database Fundamentals for Data Scientists - EAS503 Python classes and objects. In this notebook we will discuss the notion of classes and objects, which are a fundamental concept. Using the keyword `class`, one can define a class. Before learning about how to define classes, we will first understa...
github_jupyter
# BigQuery ML models with feature engineering In this notebook, we will use BigQuery ML to build more sophisticated models for taxifare prediction. This is a continuation of our [first models](../../02_bqml/solution/first_model.ipynb) we created earlier with BigQuery ML but now with more feature engineering. ## Lear...
github_jupyter
# Tutorial 11: Normalizing Flows for image modeling ![Status](https://img.shields.io/static/v1.svg?label=Status&message=Finished&color=green) **Filled notebook:** [![View notebook on Github](https://img.shields.io/static/v1.svg?logo=github&label=Repo&message=View%20On%20Github&color=lightgrey)](https://github.com/ph...
github_jupyter
``` !pip install beautifulsoup4 import urllib.request import pandas as pd import numpy as np from bs4 import BeautifulSoup,Comment import re url = "http://www.hanban.org/hanbancn/template/ciotab_cn1.htm?v1" response = urllib.request.urlopen(url) #webContent = response.read().decode(response.headers.get_content_charset(...
github_jupyter
# Distributional DQN The final improvement to the DQN agent [1] is using distributions instead of simple average values for learning the q value function. This algorithm was presented by Bellemare et al. (2018) [2]. In their math heavy manuscript, the authors introduce the distributional Belman operator and show that i...
github_jupyter
# Regularization Welcome to the second assignment of this week. Deep Learning models have so much flexibility and capacity that **overfitting can be a serious problem**, if the training dataset is not big enough. Sure it does well on the training set, but the learned network **doesn't generalize to new examples** that...
github_jupyter
# Style Transfer In this notebook we will implement the style transfer technique from ["Image Style Transfer Using Convolutional Neural Networks" (Gatys et al., CVPR 2015)](http://www.cv-foundation.org/openaccess/content_cvpr_2016/papers/Gatys_Image_Style_Transfer_CVPR_2016_paper.pdf). The general idea is to take two ...
github_jupyter
``` %matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from sklearn.metrics import accuracy_score, classification_report, confusion_matrix from sklearn.cross_validation import train_test_split, cross_val_score, KFold from sklearn.prepro...
github_jupyter
## Polygon Environment Building Devising scenarios for the polygon-based environments. ``` %load_ext autoreload %autoreload 2 from mpb import MPB, MultipleMPB from plot_stats import plot_planner_stats, plot_smoother_stats from utils import latexify from table import latex_table from definitions import * import matplot...
github_jupyter
# Classical Logic Gates with Quantum Circuits ``` from qiskit import * from qiskit.tools.visualization import plot_histogram import numpy as np ``` Using the NOT gate (expressed as `x` in Qiskit), the CNOT gate (expressed as `cx` in Qiskit) and the Toffoli gate (expressed as `ccx` in Qiskit) create functions to imple...
github_jupyter
# Train a Simple Audio Recognition model for microcontroller use This notebook demonstrates how to train a 20kb [Simple Audio Recognition](https://www.tensorflow.org/tutorials/sequences/audio_recognition) model for [TensorFlow Lite for Microcontrollers](https://tensorflow.org/lite/microcontrollers/overview). It will p...
github_jupyter
En el mundo Qt tenemos una herramienta [RAD (Rapid Application Development)](https://es.wikipedia.org/wiki/Desarrollo_r%C3%A1pido_de_aplicaciones). Esta herramienta se llama Qt DesigneEste nuevo capítulo es el último en los que enumeramos los widgets disponibles dentro de Designer, en este caso le toca el turno a los ...
github_jupyter
``` import os, sys, glob, scipy import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns ``` ## Plan 1. Describe the task 2. Make the simplest visualization you can think of that contains: - the Dependent Variable, i.e. the behavior of the participants that you're trying to mod...
github_jupyter
<a href="https://colab.research.google.com/github/AnacletoLAB/grape/blob/main/tutorials/High_performance_graph_algorithms.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # High performance graph algorithms A number of high performance algorithms hav...
github_jupyter
``` %matplotlib inline import xarray as xr import os import pandas as pd import numpy as np import skdownscale import dask import dask.array as da import dask.distributed as dd import rhg_compute_tools.kubernetes as rhgk from utils import _convert_lons, _remove_leap_days, _convert_ds_longitude from regridding import...
github_jupyter
# Jupyter Example 5 for HERMES: Neutrinos ``` from pyhermes import * from pyhermes.units import PeV, TeV, GeV, mbarn, kpc, pc, deg, rad import astropy.units as u import numpy as np import healpy import matplotlib.pyplot as plt ``` HEMRES has available two cross-section modules for $pp \rightarrow \nu$: * one bui...
github_jupyter
# Facial Keypoint Detection This project will be all about defining and training a convolutional neural network to perform facial keypoint detection, and using computer vision techniques to transform images of faces. The first step in any challenge like this will be to load and visualize the data you'll be working ...
github_jupyter
# 04 Spark essentials ``` # Make it Python2 & Python3 compatible from __future__ import print_function import sys if sys.version[0] == 3: xrange = range ``` ## Spark context The notebook deployment includes Spark automatically within each Python notebook kernel. This means that, upon kernel instantiation, there ...
github_jupyter
``` import pickle import numpy as np import mplhep import awkward import matplotlib.pyplot as plt import matplotlib.patches as mpatches import uproot import boost_histogram as bh physics_process = "qcd" data_baseline = awkward.Array(pickle.load(open("/home/joosep/reco/mlpf/CMSSW_12_1_0_pre3/11843.0/out.pkl", "rb"))) ...
github_jupyter
``` import pandas as pd import pyspark.sql.functions as F from datetime import datetime from pyspark.sql.types import * from pyspark import StorageLevel import numpy as np pd.set_option("display.max_rows", 1000) pd.set_option("display.max_columns", 1000) pd.set_option("mode.chained_assignment", None) from pyspark.ml i...
github_jupyter
<a href="https://colab.research.google.com/github/cdosrunwild/glide-text2im/blob/main/Copy_of_Disco_Diffusion_v4_1_%5Bw_Video_Inits%2C_Recovery_%26_DDIM_Sharpen%5D.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Disco Diffusion v4.1 - Now with Vid...
github_jupyter
``` # default_exp exec.parse_data ``` # uberduck_ml_dev.exec.parse_data Log a speech dataset to the filelist database Usage: ``` python -m uberduck_ml_dev.exec.parse_data \ --input ~/multispeaker-root \ --format standard-multispeaker \ --ouput list.txt ``` ### Supported formats: ### `standard-multispe...
github_jupyter
# Amazon Fraud Detector - Data Profiler Notebook ### Dataset Guidance ------- AWS Fraud Detector's Online Fraud Insights(OFI) model supports a flexible schema, enabling you to train an OFI model to your specific data and business need. This notebook was developed to help you profile your data and identify potenital...
github_jupyter
# V0.1.6 - Simulate a Predefined Model Example created by Wilson Rocha Lacerda Junior ``` pip install sysidentpy import numpy as np import pandas as pd import matplotlib.pyplot as plt from sysidentpy.metrics import root_relative_squared_error from sysidentpy.utils.generate_data import get_miso_data, get_siso_data fro...
github_jupyter
# Segmentation <div class="alert alert-info"> This tutorial is available as an IPython notebook at [Malaya/example/segmentation](https://github.com/huseinzol05/Malaya/tree/master/example/segmentation). </div> <div class="alert alert-info"> This module trained on both standard and local (included social media) ...
github_jupyter
``` import pandas as pd from sklearn.model_selection import train_test_split df = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/' 'mushroom/agaricus-lepiota.data', header=None, engine='python') column_name = ['classes','cap-shape', 'cap-surface','cap-color','bruises?','odor', ...
github_jupyter
# python behaves like a calculator ``` 8*8 ``` #### Predict the following output ``` print((5+5)/25) print(5 + 5/25) ``` python does order of operations, etc. just like a calculator #### Most of the notation is intuitive. Write out the following in a cell. What value to you get? $$ (5 \times 5 + \frac{4}{2} - ...
github_jupyter
``` try: from openmdao.utils.notebook_utils import notebook_mode except ImportError: !python -m pip install openmdao[notebooks] ``` # How to know if a System is under FD or CS All Systems (Components and Groups) have two flags that indicate whether the System is running under finite difference or complex step...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import descartes import geopandas as gpd from shapely.geometry import Point, Polygon from shapely.ops import nearest_points import seaborn as sns from mpl_toolkits.axes_grid1 import make_axes_locatable import math import time from matplotli...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Datasets/Vectors/world_database_on_protected_areas.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <...
github_jupyter
<table><tr> <td><img src="logos/JPL-NASA-logo_583x110.png" alt="JPL/NASA logo" style="height: 75px"/></td> <td><img src="logos/CEOS-LOGO.png" alt="CEOS logo" style="height: 75px"/></td> <td><img src="logos/CoverageLogoFullClear.png" alt="COVERAGE logo" style="height: 100px"/></td> </tr></table> # _Analytic...
github_jupyter
``` import cv2 import os import torch,torchvision import torch.nn as nn import numpy as np import os from tqdm import tqdm import matplotlib.pyplot as plt import torch.optim as optim from torch.nn import * from torch.utils.tensorboard import SummaryWriter import matplotlib.pyplot as plt import wandb from ray import tu...
github_jupyter
Definition of **DTLZ2 problem** with 3 objective functions: $f_1(X) = (1 + g(x_3)) \cdot cos(x_1 \cdot \frac{\pi}{2}) \cdot cos(x_2 \cdot \frac{\pi}{2})$ $f_2(X) = (1 + g(x_3)) \cdot cos(x_1 \cdot \frac{\pi}{2}) \cdot sin(x_2 \cdot \frac{\pi}{2})$ $f_3(x) = (1 + g(x_3)) \cdot sin(x_1 \cdot \frac{\pi}{2})$ with $-...
github_jupyter
``` from subprocess import call from glob import glob from nltk.corpus import stopwords import os, struct from tensorflow.core.example import example_pb2 import pyrouge import shutil from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity from nltk.stem.porter ...
github_jupyter
Based On the Canadian Marijuana Index these are the primary players in the Canadian Market. ``` from pandas_datareader import data as pdr import fix_yahoo_finance as fyf import matplotlib.pyplot as plt import datetime import numpy as np import pandas as pd import scipy # import statsmodels.api as sm from sklearn im...
github_jupyter
``` from hyppo.ksample import KSample from hyppo.independence import Dcorr from combat import combat import pandas as pd import glob import os import graspy as gp import numpy as np from dask.distributed import Client, progress import dask.dataframe as ddf from scipy.stats import zscore, rankdata, mannwhitneyu import c...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import math from plotnine import * from datetime import datetime import pytz %matplotlib inline memory_free = pd.read_parquet("path to machine metric dataset/node_memory_MemFree/") memory_free = memory_free / (1024 * 1024 * 1024) memory_total =...
github_jupyter
# Inspecting ModelSelectorResult When we go down from multiple time-series to single time-series, the best way how to get access to all relevant information to use/access `ModelSelectorResult` objects ``` import pandas as pd import matplotlib.pyplot as plt plt.style.use('seaborn') plt.rcParams['figure.figsize'] = [12,...
github_jupyter
# NumPy this notebook is based on the SciPy NumPy tutorial <div class="alert alert-block alert-warning"> Note that the traditional way to import numpy is to rename it np. This saves on typing and makes your code a little more compact.</div> ``` import numpy as np ``` NumPy provides a multidimensional array class a...
github_jupyter
# 机器学习工程师纳米学位 ## 模型评价与验证 ## 项目 1: 预测波士顿房价 欢迎来到机器学习工程师纳米学位的第一个项目!在此文件中,有些示例代码已经提供给你,但你还需要实现更多的功能来让项目成功运行。除非有明确要求,你无须修改任何已给出的代码。以**'练习'**开始的标题表示接下来的内容中有需要你必须实现的功能。每一部分都会有详细的指导,需要实现的部分也会在注释中以**'TODO'**标出。请仔细阅读所有的提示! 除了实现代码外,你还**必须**回答一些与项目和实现有关的问题。每一个需要你回答的问题都会以**'问题 X'**为标题。请仔细阅读每个问题,并且在问题后的**'回答'**文字框中写出完整的答案。你的项目将会根...
github_jupyter
``` import glob import random import sys from itertools import chain from pathlib import Path import numpy as np import pandas as pd from sklearn import preprocessing from sklearn.metrics import accuracy_score, confusion_matrix from thundersvm import SVC from tqdm import tqdm np.random.seed(0) random.seed(0) ``` ##...
github_jupyter
# Matplotlib - Intro * **matplotlib** is a Python plotting library for producing publication quality figures * allows for interactive, cross-platform control of plots * makes it easy to produce static raster or vector graphics * gives the developer complete control over the appearance of their plots, w...
github_jupyter
``` # Let printing work the same in Python 2 and 3 from __future__ import print_function # Turning on inline plots -- just for use in ipython notebooks. import matplotlib matplotlib.use('nbagg') import numpy as np import matplotlib.pyplot as plt ``` # Artists Anything that can be displayed in a Figure is an [`Artist`]...
github_jupyter
``` import pandas as pd import warnings warnings.filterwarnings("ignore") import seaborn as sns import matplotlib.pyplot as plt sns.set(style="white", color_codes=True) iris = pd.read_csv("iris.csv") # the iris dataset is now a Pandas DataFrame iris.head() iris["Species"].value_counts() # .plot extension from pandas...
github_jupyter
# Train with Scikit-learn on AzureML ## Prerequisites * Install the Azure Machine Learning Python SDK and create an Azure ML Workspace ``` import time #check core SDK version import azureml.core print("SDK version:", azureml.core.VERSION) # data_dir = '../../data_airline_updated' ``` ## Initialize workspace Initi...
github_jupyter
``` import warnings from itertools import product import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from graspy.plot import heatmap from graspy.simulations import er_np, sbm from graspy.utils import symmetrize from joblib import Parallel, delayed from scipy.stats import ttest...
github_jupyter
# Simple Image Classifier - Bring Your Own Data ## Neuronale Netze auf https://bootcamp.codecentric.ai Jetzt wird es Zeit, mit einem eigenen Dataset zu experimentieren. Hinweis: Wenn du auf einem Rechner trainierst, wo keine gut GPU verfügbar ist, kann dies sehr lange dauern. Evtl. möchtest du in dem Fall das Kapite...
github_jupyter
# Network based predictions The state of the art in crime predication increasingly appears to be "network based". That is, looking at real street networks, and assigning risk to streets, rather than areal grid cells. This is currently an introduction, a very brief literature review, and a plan of action. # Literatu...
github_jupyter
Experimenting with my hack `star_so.py` ``` #!/usr/bin/env python # All of the argument parsing is done in the `parallel.py` module. import numpy as np import Starfish from Starfish.model import ThetaParam, PhiParam #import argparse #parser = argparse.ArgumentParser(prog="star_so.py", description="Run Starfish fit...
github_jupyter
# Linear Regression <img src="https://raw.githubusercontent.com/glazec/practicalAI/master/images/logo.png" width=150> In this lesson we will learn about linear regression. We will first understand the basic math behind it and then implement it in Python. We will also look at ways of interpreting the linear model. # ...
github_jupyter
``` %matplotlib notebook import control as c import ipywidgets as w import numpy as np from IPython.display import display, HTML import matplotlib.pyplot as plt import matplotlib.patches as patches import matplotlib.animation as animation display(HTML('<script> $(document).ready(function() { $("div.input").hide(); })...
github_jupyter
<a href="https://colab.research.google.com/github/kartikgill/The-GAN-Book/blob/main/Skill-07/W-GAN.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Importing useful Libraries ``` import pandas as pd import numpy as np import matplotlib.pyplot as p...
github_jupyter
<i>Copyright (c) Microsoft Corporation. All rights reserved.</i> <i>Licensed under the MIT License.</i> # Bayesian Personalized Ranking (BPR) This notebook serves as an introduction to Bayesian Personalized Ranking (BPR) model for implicit feedback. In this tutorial, we focus on learning the BPR model using matrix ...
github_jupyter
# Day 13 - Prime number factors * https://adventofcode.com/2020/day/13 For part 1, we need to find the next multiple of a bus ID that's equal to or greater than our earliest departure time. The bus IDs, which determine their frequency, are all prime numbers, of course. We can calculate the next bus departure $t$ fo...
github_jupyter
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/tensorflow-install-mac-metal-jul-2021.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 **Manual Python Setu...
github_jupyter
``` cat ratings_train.txt | head -n 10 def read_data(filename): with open(filename, 'r') as f: data = [line.split('\t') for line in f.read().splitlines()] # txt 파일의 헤더(id document label)는 제외하기 data = data[1:] return data train_data = read_data('ratings_train.txt') test_data = read_data(...
github_jupyter
``` import pandas as pd import numpy as np import zucaml.zucaml as ml import matplotlib.pyplot as plt %matplotlib inline pd.set_option('display.max_columns', None) ``` #### gold ``` df_gold = ml.get_csv('data/gold/', 'gold', []) df_gold = df_gold.sort_values(['date', 'x', 'y', 'z'], ascending = [True, True, True,...
github_jupyter
``` #format the book %matplotlib inline from __future__ import division, print_function import sys sys.path.insert(0, '..') import book_format book_format.set_style() ``` # Converting the Multivariate Equations to the Univariate Case The multivariate Kalman filter equations do not resemble the equations for the univa...
github_jupyter
``` import glob, sys from IPython.display import HTML import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from astropy.io import fits from pyflowmaps.flow import flowLCT import warnings warnings.filterwarnings("ignore") ``` # Load the data We include in the folder *data/* a c...
github_jupyter