code
stringlengths
2.5k
150k
kind
stringclasses
1 value
# Simulation of BLER in RBF channel ``` import numpy as np import pickle from itertools import cycle, product import dill import matplotlib.pyplot as plt from scipy.spatial.distance import cdist ``` Simulation Configuration ``` blkSize = 8 chDim = 4 # Input inVecDim = 2 ** blkSize # 1-hot vector lengt...
github_jupyter
``` # Copyright 2021 Google LLC # # 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
# Exploratory Analysis ## 1) Reading the data ``` import types import pandas as pd df_claim = pd.read_csv('https://raw.githubusercontent.com/IBMDeveloperUK/Machine-Learning-Models-with-AUTO-AI/master/Data/insurance.csv') df_claim.head() df_data = pd.read_csv('https://raw.githubusercontent.com/IBMDeveloperUK/Machine...
github_jupyter
``` from pathlib import Path import awkward as ak import matplotlib.colors as colors import matplotlib.pyplot as plt import numpy as np import tqdm.notebook as tqdm import uproot run_name = "run_050016_10192021_21h49min_Ascii_build" # run_name = "build" raw_path = Path("data/raw") / f"{run_name}.root" img_path = Path...
github_jupyter
<a href="https://colab.research.google.com/github/tvml/ml2122/blob/master/codici/backprop.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Rete neurale per riconoscere caratteri. Backpropagation implementata. ``` from IPython.display import Image...
github_jupyter
<table> <tr><td align="right" style="background-color:#ffffff;"> <img src="../images/logo.jpg" width="20%" align="right"> </td></tr> <tr><td align="right" style="color:#777777;background-color:#ffffff;font-size:12px;"> Abuzer Yakaryilmaz | April 15, 2019 (updated) </td></tr> <tr><td...
github_jupyter
``` from sklearn.neural_network import MLPRegressor import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.model_selection import GridSearchCV from sklearn.preprocessing import StandardScaler from sklearn.metrics import classification_re...
github_jupyter
__GRIP at The Sparks Foundation Internship Task #1__ __Author :- Harshada Jadhav__ ## **Linear Regression with Python Scikit Learn** In this section we will see how the Python Scikit-Learn library for machine learning can be used to implement regression functions. We will start with simple linear regression involving...
github_jupyter
# Support Vector Machines (SVM) with Sklearn This notebook creates and measures an [LinearSVC with Sklearn](http://scikit-learn.org/stable/modules/generated/sklearn.svm.LinearSVC.html#sklearn.svm.LinearSVC). This has more flexibility in the choice of penalties and loss functions and should scale better to large number...
github_jupyter
## 1. Requirements ``` import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision.datasets import MNIST from torchvision import datasets, transforms from advertorch.attacks import JacobianSaliencyMapAttack as JSMA import numpy as np import matplotlib.pyplot as pl...
github_jupyter
``` import pandas as pd import numpy as np import os import json import altair as alt JSON_FILE = "../results/BDNF/Recombinants/BDNF_codons_RDP_recombinationFree.fas.FEL.json" pvalueThreshold = 0.1 def getFELData(json_file): with open(json_file, "r") as in_d: json_data = json.load(in_d) return json_data...
github_jupyter
# enable user scoped libraries ``` import site site.addsitedir(site.USER_SITE) ``` # import basic packages ``` import math import numpy as np import torch ``` # params ``` BATCH_SIZE=128 EPOCHS = 30 VALIDATION_RATIO = 0.2 RANDOM_SEED = 1 ``` # function to preprocess datasets ``` from torchvision import transform...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Preamble" data-toc-modified-id="Preamble-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Preamble</a></span><ul class="toc-item"><li><span><a href="#General-imports" data-toc-modified-id="General-imports-...
github_jupyter
``` import pandas as pd import requests from fantasy import fantasy_points from creds import nfl_api_key schedule_url = 'https://profootballapi.com/schedule' game_url = 'https://profootballapi.com/game' all_games = requests.post(schedule_url, params={'api_key': nfl_api_key, 'season_type': 'REG'}).json() ``` ## Gather...
github_jupyter
# Mixup / Label smoothing ``` %load_ext autoreload %autoreload 2 %matplotlib inline #export from exp.nb_10 import * path = datasets.untar_data(datasets.URLs.IMAGENETTE_160) tfms = [make_rgb, ResizeFixed(128), to_byte_tensor, to_float_tensor] bs = 64 il = ImageList.from_files(path, tfms=tfms) sd = SplitData.split_by_...
github_jupyter
``` import os import django from django.db import transaction import random from django_efilling.models import Instrument, InstrumentQuestion, InstrumentQuestionChoice from django_efilling.models import (ESSAY, SINGLE_CHOICE, MULTIPLE_CHOICE, IMAGE_CHOICE, Respondent) os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true" dj...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns hs_d = pd.read_csv('Housing_data.csv') hs_d.head() ``` # Exploratory Data Analysis ``` hs_d.isnull().sum() hs_d.nunique() ``` # The Cateforical features for the Dataset ``` for i in hs_d.columns: if hs_d[i].nunique(...
github_jupyter
<a href="https://colab.research.google.com/github/csd-oss/vc-investmemt/blob/master/VC_Investment.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # General preparation and GDrive conection ``` import pandas as pd import matplotlib.pyplot as plt ``...
github_jupyter
``` mylist = [1,2,3,4] for n in range(5): print(n); for n in range(3,15): print(n); for n in range(2,15,3): print(n); range(7,21,6) #is a generator list(range(7,21,6)) index_count = 0; # for letter in 'abcde': # print(f'At index {index_count} the letter is {letter}') # index_count += index_count+1 f...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt # Install pypcd from this repository import notebook_helper !{notebook_helper.get_install_cmd(quiet=True)} import pypcd print(pypcd.__version__) # Intentionally pasting the example point cloud into this cell # so the reader can inspect the ascii file format # # ...
github_jupyter
## Review Calculus using by Python Consider a sequence of n numbers $x_0, x_1, \cdots x_{n-1}$. We will start our index at 0, to remain in accordance with Python/Numpy's index system. $x_0$ is the first number in the sequence, $x_1$ is the second number in the sequence, and so forth, so $x_j$ is the general $j+1$ numb...
github_jupyter
# Introduction ## A quick overview of batch learning If you've already delved into machine learning, then you shouldn't have any difficulty in getting to use incremental learning. If you are somewhat new to machine learning, then do not worry! The point of this notebook in particular is to introduce simple notions. W...
github_jupyter
# Gaussian Mixture Model This is tutorial demonstrates how to marginalize out discrete latent variables in Pyro through the motivating example of a mixture model. We'll focus on the mechanics of parallel enumeration, keeping the model simple by training a trivial 1-D Gaussian model on a tiny 5-point dataset. See also ...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from IPython.display import display, HTML, IFrame from ipywidgets import interact,fixed from mpl_toolkits import mplot3d from mpl_toolkits.mplot3d.art3d import Poly3DCollection from matplotlib.patches import Rectangle from numpy.linalg import norm from numpy impor...
github_jupyter
## Recommender System With Pyspark ### User Ratings Using Alternative Least Square Import libraries ``` from pyspark.sql import SparkSession from pyspark.ml.recommendation import ALS from pyspark.ml.evaluation import RegressionEvaluator from pyspark.ml.tuning import TrainValidationSplit, ParamGridBuilder #import fin...
github_jupyter
# Graph optimization with QAOA One application area where near-term quantum hardware is expected to shine is in graph optimization. Graph-based problems are interesting to explore because they have both strong links to practical use-cases (such as logistics and social networks) and are also often hard to solve. ![gra...
github_jupyter
# Practical Session 3: Ensemble Learning Techniques *Notebook by Ekaterina Kochmar* This practical will address the use of ensemble-based learning techniques. You will be working with the otherwise familiar settings of classification and regression tasks. In this practical, you will use the familiar datasets and will...
github_jupyter
``` %matplotlib inline ``` # Cross-validation on diabetes Dataset Exercise A tutorial exercise which uses cross-validation with linear models. This exercise is used in the `cv_estimators_tut` part of the `model_selection_tut` section of the `stat_learn_tut_index`. ``` from __future__ import print_function print(_...
github_jupyter
``` # training dataset training_data = [ ['Yes', 'No','No','Yes','Some','$$$','No','Yes','French','0-10','Yes'], ['Yes', 'No', 'No', 'Yes', 'Full', '$', 'No', 'No', 'Thai', '30-60', 'No'], ['No', 'Yes', 'No', 'No', 'Some', '$', 'No', 'No', 'Burger', '0-10', 'Yes'], ['Yes', 'No', 'Yes', 'Yes', 'Full', '$...
github_jupyter
``` import plaidml.keras plaidml.keras.install_backend() import os os.environ["KERAS_BACKEND"] = "plaidml.keras.backend" # Importing useful libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn.preprocessing import MinMaxScaler from keras.models import Sequential from keras.layer...
github_jupyter
# Optimization Methods Until now, you've always used Gradient Descent to update the parameters and minimize the cost. In this notebook, you will learn more advanced optimization methods that can speed up learning and perhaps even get you to a better final value for the cost function. Having a good optimization algorit...
github_jupyter
``` from torchvision.models import * import wandb from sklearn.model_selection import train_test_split import os,cv2 import numpy as np import matplotlib.pyplot as plt from torch.nn import * import torch,torchvision from tqdm import tqdm device = 'cuda' PROJECT_NAME = 'Intel-Image-Classification-TL' def load_data(): ...
github_jupyter
# Beacon Time Series, across the transition Edit selector= below Look at the beacons with the largest normalized spread. ( Steal plotMultiBeacons() from here.) ``` import math import numpy as np import pandas as pd import BQhelper as bq %matplotlib nbagg import matplotlib.pyplot as plt bq.project = "mlab-sandbox"...
github_jupyter
<a href="https://colab.research.google.com/github/shakasom/MapsDataScience/blob/master/Chapter4.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Making sense of humongous location datasets ## Installations The geospatial libraries are not pre ins...
github_jupyter
``` from sklearn.datasets import load_files import os PATH = '/home/mikhail/Documents/ML/лекции/mlcourse_open-master/data/imdb_reviews' !du -hs $PATH %%time train_reviews = load_files(os.path.join(PATH, 'train')) %%time test_reviews = load_files(os.path.join(PATH, 'train')) len(train_reviews.data) len(test_reviews.data...
github_jupyter
Lambda School Data Science *Unit 2, Sprint 1, Module 3* --- # Ridge Regression ## Assignment We're going back to our other **New York City** real estate dataset. Instead of predicting apartment rents, you'll predict property sales prices. But not just for condos in Tribeca... - [ ] Use a subset of the data where...
github_jupyter
<i>Copyright (c) Microsoft Corporation. All rights reserved.<br> Licensed under the MIT License.</i> <br> # Model Comparison for NCF Using the Neural Network Intelligence Toolkit This notebook shows how to use the **[Neural Network Intelligence](https://nni.readthedocs.io/en/latest/) toolkit (NNI)** for tuning hyperpa...
github_jupyter
# Load MXNet model In this tutorial, you learn how to load an existing MXNet model and use it to run a prediction task. ## Preparation This tutorial requires the installation of Java Kernel. For more information on installing the Java Kernel, see the [README](https://github.com/awslabs/djl/blob/master/jupyter/READM...
github_jupyter
# 3장. 사이킷런을 타고 떠나는 머신 러닝 분류 모델 투어 **아래 링크를 통해 이 노트북을 주피터 노트북 뷰어(nbviewer.jupyter.org)로 보거나 구글 코랩(colab.research.google.com)에서 실행할 수 있습니다.** <table class="tfo-notebook-buttons" align="left"> <td> <a target="_blank" href="https://nbviewer.jupyter.org/github/rickiepark/python-machine-learning-book-2nd-edition/blob...
github_jupyter
## Importing Necessary Libraries and Functions The first thing we need to do is import the necessary functions and libraries that we will be working with throughout the topic. We should also go ahead and upload all the of the necessary data sets here instead of loading them as we go. We will be using energy production...
github_jupyter
``` from tqdm.notebook import tqdm import math import gym import torch import torch.optim as optim from torch.utils.tensorboard import SummaryWriter from collections import deque from active_rl.networks.dqn_atari import DQN from active_rl.utils.memory import ReplayMemory from active_rl.utils.optimization import stand...
github_jupyter
## Initial setup ``` from google.colab import drive drive.mount('/content/drive') import tensorflow as tf print(tf.__version__) # tensorflow version used is 2.8.0 import torch print(torch.__version__) # torch version used is 1.10+cu111 !nvidia-smi # Other imports ! pip install tensorflow_addons ! pip install tensorflo...
github_jupyter
## 1. Importi ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from datetime import datetime import csv import os.path import mplcyberpunk plt.style.use("cyberpunk") ``` ## 2. Branje podatkov ``` with open('../data/kd2018.csv', 'rt') as csvfile: reader = csv.reader(csvfile, delimiter='...
github_jupyter
``` import numpy as np import json import re from collections import defaultdict import spacy import matplotlib.pyplot as plt %matplotlib inline annotation_file = '../vqa-dataset/Annotations/mscoco_%s_annotations.json' annotation_sets = ['train2014', 'val2014'] question_file = '../vqa-dataset/Questions/OpenEnded_mscoco...
github_jupyter
``` %matplotlib inline ``` # Spectral clustering for image segmentation In this example, an image with connected circles is generated and spectral clustering is used to separate the circles. In these settings, the `spectral_clustering` approach solves the problem know as 'normalized graph cuts': the image is seen ...
github_jupyter
``` %matplotlib inline from image_registration import chi2_shift from matplotlib import pyplot as plt from matplotlib import rcParams import seaborn as sns import numpy as np import cv2 all_imgs = !ls 210226_Bladder_TMA1_reg35/1_shading_correction/*.tif | grep DAPI for i,z in enumerate(all_imgs): print(i, z) ...
github_jupyter
<center> <img src="img/scikit-learn-logo.png" width="40%" /> <br /> <h1>Robust and calibrated estimators with Scikit-Learn</h1> <br /><br /> Gilles Louppe (<a href="https://twitter.com/glouppe">@glouppe</a>) <br /><br /> New York University </center> ``` # Global imports and settings # Mat...
github_jupyter
``` import tensorflow as tf import matplotlib.pyplot as plt import random import time from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) learning_rate = 0.001 training_epochs = 15 batch_size = 100 input_x = tf.placeholder(tf.float32, [None,784]) # 이...
github_jupyter
## Benchmarking Scipy Signal vs cuSignal Time to Create Windows in Greenflow The windows examples were taken from the example [cusignal windows notebook](https://github.com/rapidsai/cusignal/blob/branch-21.08/notebooks/api_guide/windows_examples.ipynb). ### General Parameters ``` import cupy.testing as cptest from g...
github_jupyter
``` import importlib import pathlib import os import sys from datetime import datetime, timedelta import pandas as pd module_path = os.path.abspath(os.path.join('../..')) if module_path not in sys.path: sys.path.append(module_path) datetime.now() ticker="GME" report_name=f"{ticker}_{datetime.now().strftime('%Y%m%d_...
github_jupyter
``` # Get imports import pickle import numpy as np import cv2 import glob import matplotlib.pyplot as plt import matplotlib.image as mpimg %matplotlib qt # import helper functions import camera_calibrator import distortion_correction import image_binary_gradient import perspective_transform import detect_lane_pixels im...
github_jupyter
# Setting up ``` # Dependencies %matplotlib inline import matplotlib.pyplot as plt import pandas as pd import numpy as np import seaborn as sns from scipy.stats import sem plt.style.use('seaborn') # Hide warning messages in notebook # import warnings # warnings.filterwarnings('ignore') ``` # Importing 4 csv files a...
github_jupyter
# Content personalization ## Without context This example takes inspiration from Vowpal Wabbit's [excellent tutorial](https://vowpalwabbit.org/tutorials/cb_simulation.html). Content personalization is about taking into account user preferences. It's a special case of recommender systems. Ideally, side-information sh...
github_jupyter
# Simple dynamic seq2seq with TensorFlow This tutorial covers building seq2seq using dynamic unrolling with TensorFlow. I wasn't able to find any existing implementation of dynamic seq2seq with TF (as of 01.01.2017), so I decided to learn how to write my own, and document what I learn in the process. I deliberately...
github_jupyter
# Segmented deformable mirrors We will use segmented deformable mirrors and simulate the PSFs that result from segment pistons and tilts. We will compare this functionality against Poppy, another optical propagation package. First we'll import all packages. ``` import os import numpy as np import matplotlib.pyplot a...
github_jupyter
### Contexto Base de Dados de Churn <br> [IBM Sample Data Sets] ### Conteúdo Cada linha representa um cliente. <br> Cada coluna contém os atributos do cliente descritos na coluna Metadados. O conjunto de dados inclui informações sobre: <br> Clientes que saíram no último mês - a coluna é chamada de rotatividade <br>...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.read_csv('austin_weather.csv') df.head() df.info() ``` <h2>Visualisasi Scatter Plot Perbandingan Kuantitatif</h2> Pada tugas kali ini kita akan mengamati nilai DewPointAvg (F) dengan mengamati nilai HumidityAvg (%), TempAvg (F), dan ...
github_jupyter
# Preliminaries: imports, start H2O, load data ``` import sklearn import pandas as pd import numpy as np import shap import h2o from h2o.automl import H2OAutoML df = pd.read_csv('C:/Users/Karti/NEU/data/insurance.csv') df.head() h2o.init() data_path = 'C:/Users/Karti/NEU/data/insurance.csv' h2o_df = h2o.import_file(da...
github_jupyter
# Convolutional Neural Networks: Step by Step Welcome to Course 4's first assignment! In this assignment, you will implement convolutional (CONV) and pooling (POOL) layers in numpy, including both forward propagation and (optionally) backward propagation. **Notation**: - Superscript $[l]$ denotes an object of the $l...
github_jupyter
# Mapboxgl Python Library for location data visualizaiton https://github.com/mapbox/mapboxgl-jupyter ### Requirements These examples require the installation of the following python modules ``` pip install mapboxgl pip install pandas ``` ``` import pandas as pd import os from mapboxgl.utils import * from mapboxgl....
github_jupyter
# ARC Tools ## Coordinates conversions Below, `xyz` and `zmat` refer to Cartesian and internal coordinates, respectively ``` from arc.species.converter import (zmat_to_xyz, xyz_to_str, zmat_from_xyz, zmat_to_str, ...
github_jupyter
## Learning Pandas and Matplotlib Pandas is pythons library that enables broad possibilities for data analysis. By using Pandas it is very easy to upload, manage and analyse data from different tables by using SQL-like commands. Moreover, in connection with the libraries Matplotlib and Seaborn, Pandas gives broad oppo...
github_jupyter
# Fisheries competition 大自然保护渔业监测 In this notebook we're going to investigate a range of different architectures for the [Kaggle fisheries competition](https://www.kaggle.com/c/the-nature-conservancy-fisheries-monitoring/). The video states that vgg.py and ``vgg_ft()`` from utils.py have been updated to include VGG w...
github_jupyter
``` println("Hello World") // make sure we're in a spark kernel ``` # Scala for Spark - Assignment Learning Scala the hard way. ## Part 1: The Basics ``` /* Try the REPL Scala has a tool called the REPL (Read-Eval-Print Loop) that is analogous to commandline interpreters in many other languages. You may type...
github_jupyter
# How Debuggers Work Interactive _debuggers_ are tools that allow you to selectively observe the program state during an execution. In this chapter, you will learn how such debuggers work – by building your own debugger. ``` from bookutils import YouTubeVideo YouTubeVideo("4aZ0t7CWSjA") ``` **Prerequisites** * You...
github_jupyter
``` import gpt_2_simple as gpt2 import os import requests !pip install nltk import nltk nltk.download('averaged_perceptron_tagger') from nltk.tag import pos_tag !nvidia-smi # gpt2.download_gpt2(model_name="117M") sess = gpt2.start_tf_sess() gpt2.load_gpt2(sess, run_name='run3') gpt2.generate(sess, run_name='run3') file...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np from datetime import timedelta subject = 'EGD-0125' csv_file = 'clinical_data.csv' xnat_path = 'https://bigr-rad-xnat.erasmusmc.nl' user = '' project = 'EGD' ## Difference in dates between sources, due to anonimization num_days_anon = -1 res = pd.read_csv(csv_fi...
github_jupyter
# Course Outline * Step 0: 載入套件並下載語料 * Step 1: 將語料讀進來 * Step 2: Contingency table 和 keyness 計算公式 * Step 3: 計算詞頻 * Step 4: 計算 keyness * Step 5: 找出 PTT 兩板的 keywords * Step 6: 視覺化 # Step 0: 載入套件並下載語料 ``` import re # 待會會使用 regular expression import math # 用來計算 log import pandas as pd # 用來製作表格 import matplot...
github_jupyter
``` # HIDDEN from datascience import * from prob140 import * import numpy as np import matplotlib.pyplot as plt plt.style.use('fivethirtyeight') %matplotlib inline # HIDDEN def joint_probability(x, y): if x == 1 & y == 1: return 2/8 elif abs(x - y) < 2: return 1/8 else: return 0 ...
github_jupyter
# AI Hub Open API 서비스 https://aiopen.etri.re.kr/service_list.php ## 오픈 AI API·DATA 서비스 - ETRI에서 과학기술정보통신부 R&D 과제를 통해 개발된 최첨단 인공지능 기술들을 오픈 API 형태로 개발 - 중소·벤처 기업, 학교, 개인 개발자 등의 다양한 사용자들에게 제공 > API(Application Programming Interface): 컴퓨터나 컴퓨터 프로그램 사이의 연결을 할 수 있도록 제공 # 위키백과 QA API 란? > 자연어로 기술된 질문의 의미를 분석하여,...
github_jupyter
<div> <img src="https://drive.google.com/uc?export=view&id=1vK33e_EqaHgBHcbRV_m38hx6IkG0blK_" width="350"/> </div> #**Artificial Intelligence - MSc** This notebook is designed specially for the module ET5003 - MACHINE LEARNING APPLICATIONS Instructor: Enrique Naredo ###ET5003_GaussianProcesses © All rights reserv...
github_jupyter
The most common analytical task is to take a bunch of numbers in dataset and summarise it with fewer numbers, preferably a single number. Enter the 'average', sum all the numbers and divide by the count of the numbers. In mathematical terms this is known as the 'arithmetic mean', and doesn't always summarise a dataset ...
github_jupyter
## Get the data ``` import os import tarfile import urllib.request DOWNLOAD_ROOT = "http://spamassassin.apache.org/old/publiccorpus/" HAM_URL = DOWNLOAD_ROOT + "20030228_easy_ham.tar.bz2" SPAM_URL = DOWNLOAD_ROOT + "20030228_spam.tar.bz2" SPAM_PATH = os.path.join("datasets", "spam") def fetch_spam_data(ham_url=HAM_U...
github_jupyter
``` import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from sklearn.preprocessing import MinMaxScaler import model from datetime import datetime from datetime import timedelta sns.set() df = pd.read_csv('/home/husein/space/Stock-Prediction-Comparison/dat...
github_jupyter
# 11 ODE Applications (Projectile motion) – Part 1 Let's apply our ODE solvers to some problems involving balls and projectiles. The `integrators.py` file from [Lesson 10](http://asu-compmethodsphysics-phy494.github.io/ASU-PHY494//2018/02/20/10_ODEs/) is used here (and named [`ode.py`](https://github.com/ASU-CompMetho...
github_jupyter
``` import pandas as pd import geopandas as gpd import matplotlib.pyplot as plt import numpy as np from shapely.geometry import Point from sklearn.neighbors import KNeighborsRegressor import rasterio as rst from rasterstats import zonal_stats %matplotlib inline path = r"[CHANGE THIS PATH]\Wales\\" data = pd.read_csv(p...
github_jupyter
``` import numpy as np import pandas as pd import mlflow import mlflow.sklearn from gensim.utils import simple_preprocess from sklearn.model_selection import train_test_split from gensim.models.doc2vec import Doc2Vec, TaggedDocument import gensim from gensim import corpora import nltk.stem nltk.download('rslp') from ge...
github_jupyter
<a href="https://colab.research.google.com/github/escheytt/tensorflow/blob/master/FHLD_Class_1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import pandas as pd from google.colab import files uploaded = files.upload() for fn in uploaded.keys...
github_jupyter
# Basics of Signal Processing **Authors**: Anmol Parande, Hoang Nguyen, Jordan Grelling ``` import numpy as np import scipy import matplotlib.pyplot as plt from scipy.io import wavfile import IPython.display as ipd import scipy.signal as signal import time ``` Throughout this notebook, we will be working with a clip ...
github_jupyter
``` import json import os import tqdm import pandas as pd ``` ## I. convert emails text (both training and testing) into appropriate jsonl file format ### 6088 entries in training set ( 2000+ machine generated, the rest are human-written) #### 4000+ are from email corpus, 2000+ are from gtp-2 generated and the ENRON ...
github_jupyter
# Merge & Concat En muchas ocasiones nos podemos encontrar con que los conjuntos de datos no se encuentran agregados en una única tabla. Cuando esto sucede, existen dos formas para unir la información de distintas tablas: **merge** y **concat**. ## Concat La función `concat()` realiza todo el trabajo pesado de real...
github_jupyter
# Principi AI L'intelligenza artificiale dalla sua definizione significa avere la capacità di apprendere e di eseguire compiti in maniera simile a quella umana, è presente però la necessità di usare la programmazione per fare in modo che un calcolatore esibisca queste caratteristiche. ## Differenze tra programmazione...
github_jupyter
``` import pandas as pd from math import pow, sqrt import time import numpy as np from sklearn.metrics.pairwise import cosine_similarity from sklearn.feature_extraction.text import CountVectorizer ratings = pd.read_csv('./ml-latest-small/ratings.csv') movies = pd.read_csv('./ml-latest-small/movies.csv') movies # users...
github_jupyter
# for Mac OS ``` import os os.environ['KMP_DUPLICATE_LIB_OK']='True' import math import random import gym import numpy as np import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.distributions import Categorical from IPython.display import clear_output import matpl...
github_jupyter
# Clase 1: Introducción al curso - IE0417: Diseño de Software para Ingeniería ## Introducción Profesor - Esteban Zamora Alvarado - [LinkedIn](https://www.linkedin.com/in/esteban-zamora-a54484102/) #### Bach Ing. Eléctrica UCR (2014-2018) - Énfasis en Compus y Redes - PRIS-Lab: High Performance Computing (HPC) #### ...
github_jupyter
# Overview This Jupyter Notebook takes in data from a Google Sheet that contains line change details and their associated high level categories and outputs a JSON file for the MyBus tool. The output file is used by the MyBus tool's results page and contains the Line-level changes that are displayed there. Run all ce...
github_jupyter
# Region Based Data Analysis The following notebook will go through prediction analysis for region based Multiple Particle Tracking (MPT) using OGD severity datasets for non-treated (NT) hippocampus, ganglia, thalamus, cortex, and striatum. ## Table of Contents [1. Load Data](#1.-load-data)<br /> [2. Analys...
github_jupyter
# DataFrames DataFrames are the workhorse of pandas and are directly inspired by the R programming language. We can think of a DataFrame as a bunch of Series objects put together to share the same index. Let's use pandas to explore this topic! ``` import pandas as pd import numpy as np from numpy.random import randn ...
github_jupyter
## Tutorial on how to implement periodic boundaries This tutorial will show how to implement Periodic boundary conditions (where particles that leave the domain on one side enter again on the other side) can be implemented in Parcels The idea in Parcels is to do two things: 1) Extend the fieldset with a small 'halo' ...
github_jupyter
# Lab 3: Tables Welcome to lab 3! This week, we'll learn about *tables*, which let us work with multiple arrays of data about the same things. Tables are described in [Chapter 6](https://www.inferentialthinking.com/chapters/06/Tables) of the text. First, set up the tests and imports by running the cell below. ``` ...
github_jupyter
``` %matplotlib inline import arviz as az import matplotlib.pyplot as plt import numpy as np import pandas as pd import pymc as pm import scipy as sp import seaborn as sns sns.set(context='notebook', font_scale=1.2, rc={'figure.figsize': (12, 5)}) plt.style.use(['seaborn-colorblind', 'seaborn-darkgrid']) RANDOM_SEED...
github_jupyter
``` """ =================================================== Faces recognition example using eigenfaces and SVMs =================================================== The dataset used in this example is a preprocessed excerpt of the "Labeled Faces in the Wild", aka LFW_: http://vis-www.cs.umass.edu/lfw/lfw-funneled.tgz ...
github_jupyter
<a href="https://colab.research.google.com/github/ash12hub/DS-Unit-2-Tree-Ensembles/blob/master/Ashwin_Raghav_Swamy_Decision_Tree_Classifier_CC.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Decision Tree Classifier: Coding Challenge Decision tr...
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
# TIC TAC TOE GAMES ``` import random as rd from IPython.display import clear_output from tabulate import tabulate player = [1,2] O = 'O' X = 'X' K = ' ' ``` ## Function ``` def gantian(iPLayer): if iPLayer == 1: iPLayer = 2 elif iPLayer == 2: iPLayer = 1 return iPLayer def isi(valcon,iPl...
github_jupyter
``` import warnings warnings.filterwarnings('ignore') %matplotlib notebook import pandas as pd import numpy as np from util import * from sklearn.model_selection import train_test_split from sklearn import metrics from skater.core.global_interpretation.interpretable_models.brlc import BRLC from skater.core.global_inte...
github_jupyter
# Using QAOA to solve a UD-MIS problem ``` import numpy as np import igraph from itertools import combinations import matplotlib.pyplot as plt from pulser import Pulse, Sequence, Register from pulser.simulation import Simulation from pulser.devices import Chadoq2 from scipy.optimize import minimize ``` ## 1. Intro...
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 torch import nn from collections import OrderedDict import torch.nn.functional as F import torch from torch.utils.data import DataLoader import torchvision import random from torch.utils.data import Subset from matplotlib import pyplot as plt from torchsummary import summary from torchvision import transforms ...
github_jupyter
# Node Embeddings and Skip Gram Examples **Purpose:** - to explore the node embedding methods used for methods such as Word2Vec. **Introduction-** one of the key methods used in node classification actually draws inspiration from natural language processing. This based in the fact that one approach for natural langua...
github_jupyter