text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` # Import libraries import os import ee import geemap import ipywidgets as widgets from bqplot import pyplot as plt from ipyleaflet import WidgetControl # Create an interactive map Map = geemap.Map(center=[-23.36, -46.36], zoom=5, add_google_map=True) Map # Definindo a barra interativa style = {'description_width'...
github_jupyter
``` %matplotlib inline import pandas as pd import os import bidi.algorithm import arabic_reshaper import matplotlib.pyplot as plt fpath = '/media/sf_VBox_Shared/Arabic/Analyses/Fiqh_final2/quotes' links_df = pd.read_csv(os.path.join(fpath, 'fiqh_quran_links_v2.csv')) nodes_aya_df = pd.read_csv(os.path.join(fpath, 'fiqh...
github_jupyter
# Multi-Fidelity <div class="btn btn-notebook" role="button"> <img src="../_static/images/colab_logo_32px.png"> [Run in Google Colab](https://colab.research.google.com/drive/1Cc9TVY_Tl_boVzZDNisQnqe6Qx78svqe?usp=sharing) </div> <div class="btn btn-notebook" role="button"> <img src="../_static/images/github_log...
github_jupyter
## **Semana de Data Science** - Minerando Dados ## Aula 01 ### Conhecendo a base de dados Monta o drive ``` from google.colab import drive drive.mount('/content/drive') ``` Importando as bibliotecas básicas ``` import pandas as pd import seaborn as sns import numpy as np import matplotlib.pyplot as plt %matplotl...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt import matplotlib.backends.backend_pdf as pdf import matplotlib.patches as pch import eleanor_constants as EL matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fonttype'] = 42 %matplotlib inline ### PLOT STARVE...
github_jupyter
# Intro to scikit-learn, SVMs and decision trees <hr style="clear:both"> This notebook is part of a series of exercises for the CIVIL-226 Introduction to Machine Learning for Engineers course at EPFL. Copyright (c) 2021 [VITA](https://www.epfl.ch/labs/vita/) lab at EPFL Use of this source code is governed by an MIT...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import pickle %matplotlib inline thirteen_genre_df = pd.read_pickle('/content/13_genre.pkl') thirteen_genre_df.head() thirteen_genre_df = thirteen_genre_df.set_index('Genre_first') thirteen_genre_df thirteen_genre_list = sorted(list(set([x for x...
github_jupyter
# NIRCam F444W Coronagraphic Observations of Vega --- Here we create the basics for a MIRI simulation to observe the Fomalhaut system with the FQPM 1550. This includes simulating the Fomalhaut stellar source behind the center of the phase mask, some fake off-axis companions, and a debris disk model that crosses the ma...
github_jupyter
# Deep Neural Networks (DNN) Model Development ## Preparing Packages ``` import numpy as np import matplotlib import matplotlib.pyplot as plt import pandas as pd import tensorflow as tf from sklearn import metrics from numpy import genfromtxt from scipy import stats from sklearn import preprocessing from keras.callba...
github_jupyter
<h2>Cheat sheet for numpy/scipy factorizations and operations on sparse matrices</h2> Python's API for manipulating sparse matrices is not as well designed as Matlab's. In Matlab, you can do (almost) anything to a sparse matrix with the same syntax as a dense matrix, or any mixture of dense and sparse. In numpy/scipy...
github_jupyter
## Classification - Before and After MMLSpark ### 1. Introduction <p><img src="https://images-na.ssl-images-amazon.com/images/G/01/img16/books/bookstore/landing-page/1000638_books_landing-page_bookstore-photo-01.jpg" style="width: 500px;" title="Image from https://images-na.ssl-images-amazon.com/images/G/01/img16/boo...
github_jupyter
# Coordinate Descent ### Lower Bound, Take 4 Ensure feasibility of "Lower Bound, Take 2" by adjusting alpha as necessary. ### Lower Bound, Take 3 Ensure feasibility by allowing a stochastic mixture with the MLE. Doesn't work (not DCP). Assume $r_{\min} = 0$ for simplicity. Idea for online solving $$ \begin{align...
github_jupyter
##### Copyright 2018 The TensorFlow Hub Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` # Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. ...
github_jupyter
# DRF of CNS-data ``` %load_ext autoreload %autoreload 2 %matplotlib notebook import pandas as pd import matplotlib.pyplot as plt import numpy as np import networkx as nx from matplotlib.colors import LogNorm from sklearn.utils import shuffle from itertools import groupby from matplotlib.figure import figaspect # p...
github_jupyter
# Example data analysis notebook This notebook downloads and analyses some surface air temperature anomaly data from [Berkeley Earth](http://berkeleyearth.org/). Import the required libraries. ``` import matplotlib.pyplot as plt import pandas as pd import requests ``` Use the [requests](http://docs.python-requests....
github_jupyter
# Policy Evaluation in Contextual Bandits ** * This IPython notebook illustrates the usage of the [contextualbandits](https://www.github.com/david-cortes/contextualbandits) package's `evaluation` module through a simulation with public datasets. ** Small note: if the TOC here is not clickable or the math symbols don...
github_jupyter
``` !pip install scikit-learn==1.0 !pip install xgboost==1.4.2 !pip install catboost==0.26.1 !pip install pandas==1.3.3 !pip install radiant-mlhub==0.3.0 !pip install rasterio==1.2.8 !pip install numpy==1.21.2 !pip install pathlib==1.0.1 !pip install tqdm==4.62.3 !pip install joblib==1.0.1 !pip install matplotlib==3.4....
github_jupyter
## 1 卷积神经网络 在之前的神经网络学习过程中,使用的都是全连接神经网络,全连接神经网络对识别和预测都有非常好的效果。在之前使用 MNIST 数据集的实践过程中,输入神经网络的是是一幅 28 行 28 列的 784 个像素点的灰度值,但是仅两层神经网络就有十多万个待训练参数(第一层$784\times128$个$\omega+128个b$,第二层$128\times10$个$z\omega+10个b$,共 101770 个参数)。 在实际项目中,输入神经网络的是具有更高分辨率的彩色图片,使得送入全连接网络的输入特征数特别多,随着隐藏层数的增加,网络规模过大,待优化参数过多,很容易造成过拟合。**为了减少待训练参数,在实际应用...
github_jupyter
# Data Prediction #### Importing Libraries ``` import tensorflow as tf from tensorflow.keras import models import numpy as np from PIL import Image import cv2 import imutils ``` #### Global Variables ``` bg = None temp_image = 'temp.png' ``` ### Resize Image Used to resize the image given as input. ``` def resiz...
github_jupyter
# Import libraries needed to plot data ``` import math import numpy as np import pandas as pd import scipy.special from bokeh.layouts import gridplot from bokeh.io import show, output_notebook, save, output_file from bokeh.plotting import figure from bokeh.models import BoxAnnotation, HoverTool, ColumnDataSource, Num...
github_jupyter
# TreeDLib ``` %load_ext autoreload %autoreload 2 %load_ext sql #from treedlib import * # Note: reloading for submodules doesn't work, so we load directly here from treedlib.util import * from treedlib.structs import * from treedlib.templates import * from treedlib.features import * import lxml.etree as et import nump...
github_jupyter
# Week 10 - Create and manage a digital bookstore collection *© 2021 Colin Conrad* Welcome to Week 10 of INFO 6270! Last week marked an important milestone, in the sense that you completed the second course unit on core data science skills. Starting this week, we will have three labs on "other skills" that are valuabl...
github_jupyter
<a href="https://colab.research.google.com/github/probml/pyprobml/blob/master/notebooks/hbayes_binom_rats_pymc3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> We fit a hierarchical beta-binomial model to some count data derived from rat survival. (...
github_jupyter
# Basics and Package Structure If you're just interested in pulling data, you will primarily be using `nba_api.stats.endpoints`. This submodule contains a class for each API endpoint supported by stats.nba.com. For example, [the PlayerCareerStats class](https://github.com/swar/nba_api/blob/master/nba_api/stats/endpoin...
github_jupyter
# Think Bayes This notebook presents example code and exercise solutions for Think Bayes. Copyright 2018 Allen B. Downey MIT License: https://opensource.org/licenses/MIT ``` # Configure Jupyter so figures appear in the notebook %matplotlib inline # Configure Jupyter to display the assigned value after an assignmen...
github_jupyter
# The DataFetcher The DataFetcher class is by detex to serve seismic data to other functions and classes. It is designed to use data from local directories as well as remote clients (like the [obspy FDSN client](https://docs.obspy.org/packages/obspy.fdsn.html)). In the future I hope to add functionality to the DataFetc...
github_jupyter
``` import datetime import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cm as cmx df = pd.read_csv("./data/users/user_survey_raw.csv") col_names = ["ts","version","application","switch","share","choice","cyclone_confidence","cyclone_nps","cyclone_...
github_jupyter
<img src='./img/logoline_12000.png' align='right' width='100%'></img> # Tutorial on creating a climate index for wind chill In this tutorial we will plot a map of wind chill over Europe using regional climate reanalysis data (UERRA) of wind speed and temperature. From the WEkEO Jupyterhub we will download this data fr...
github_jupyter
# Automatic music generation system (AMGS) - Pop genre An affective rule-based generative music system that generates retro pop music. ``` import numpy as np import pandas as pd import mido import scipy.io import time import statistics from numpy.random import choice from IPython.display import clear_output import m...
github_jupyter
``` # Copyright 2019 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
``` con <- url("http://www2.math.su.se/~esbj/GLMbook/moppe.sas") data <- readLines(con, n = 200L, warn = FALSE, encoding = "unknown") close(con) data.start <- grep("^cards;", data) + 1L data.end <- grep("^;", data[data.start:999L]) + data.start - 2L table.1.2 <- read.table(text = data[data.start:data.end], ...
github_jupyter
<img width="10%" alt="Naas" src="https://landen.imgix.net/jtci2pxwjczr/assets/5ice39g4.png?w=160"/> # Remotive - Post daily jobs on slack <a href="https://app.naas.ai/user-redirect/naas/downloader?url=https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/Remotive/Remotive_Post_daily_jobs_on_slack.ipy...
github_jupyter
AMUSE tutorial on multiple code in a single bridge ==================== A cascade of bridged codes to address the problem of running multiple planetary systems in, for example, a star cluster. This is just an example of how to initialize such a cascaded bridge without any stellar evolution, background potentials. The ...
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
# Data Visualization with Python and Jupyter In this module of the course, we will use some of the libraries available with Python and Jupyter to examine our data set. In order to better understand the data, we can use visualizations such as charts, plots, and graphs. We'll use some commont tools such as [`matplotlib`...
github_jupyter
# Sampler statistics When checking for convergence or when debugging a badly behaving sampler, it is often helpful to take a closer look at what the sampler is doing. For this purpose some samplers export statistics for each generated sample. ``` import numpy as np import matplotlib.pyplot as plt import seaborn as sb...
github_jupyter
<a href="https://colab.research.google.com/github/moh2236945/Natural-language-processing/blob/master/Multichannel_CNN_Model_for_Text_Classification.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` ``` model can be expanded by using multiple para...
github_jupyter
<img width="10%" alt="Naas" src="https://landen.imgix.net/jtci2pxwjczr/assets/5ice39g4.png?w=160"/> # NASA - Sea level <a href="https://app.naas.ai/user-redirect/naas/downloader?url=https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/NASA/NASA_Sea_level.ipynb" target="_parent"><img src="https://naa...
github_jupyter
# Introduction In a prior notebook, documents were partitioned by assigning them to the domain with the highest Dice similarity of their term and structure occurrences. The occurrences of terms and structures in each domain is what we refer to as the domain "archetype." Here, we'll assess whether the observed similari...
github_jupyter
# Udacity. Deep Reingorcement Learning : Collaboration and Competition ### Markus Buchholz ``` from unityagents import UnityEnvironment import numpy as np env = UnityEnvironment(file_name='./Tennis_Linux/Tennis.x86_64') ``` ## BRAIN ``` # get the default brain brain_name = env.brain_names[0] brain = env.brains[brain...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/HowEarthEngineWorks/ClientVsServer.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_b...
github_jupyter
## Overfitting Exercise In this exercise, we'll build a model that, as you'll see, dramatically overfits the training data. This will allow you to see what overfitting can "look like" in practice. ``` import os import pandas as pd import numpy as np import math import matplotlib.pyplot as plt ``` For this exercise,...
github_jupyter
# JAGS example in PyMC3 This notebook attempts to solve the same problem that has been solved manually in [w02-04b-mcmc-demo-continuous.ipynb](http://localhost:8888/notebooks/w02-04b-mcmc-demo-continuous.ipynb), but using PyMC3 instead of JAGS as demonstrated in the course video. ## Problem Definition Data is for pe...
github_jupyter
# Importing libraries ``` import sys, os, re, csv, subprocess, operator import pandas as pd from urllib.request import urlopen import urllib.request from bs4 import BeautifulSoup ``` # Configure repository and directories ``` userhome = os.path.expanduser('~') txt_file = open(userhome + r"/DifferentDiffAlgorithms/SZ...
github_jupyter
# Part 1: Getting Started with Sionna This tutorial will guide you through Sionna, from its basic principles to the implementation of a point-to-point link with a 5G NR compliant code and a 3GPP channel model. You will also learn how to write custom trainable layers by implementing a state of the art neural receiver, ...
github_jupyter
# Gap Framework - Natural Language Processing ## Syntax Module <b>[Github] (https://github.com/andrewferlitsch/gap)</b> # Document Preparation for NLP with Gap (Session 2) Let's dig deeper into the basics. We will be using the <b style='color: saddlebrown'>SYNTAX</b> module in the **Gap** framework. ## <span style...
github_jupyter
Saturation curves for SM-omics and ST<br> Input files are generated by counting number of unique molecules and number of annotated reads per annotated region after adjusting for sequencing depth, in downsampled fastq files (proportions 0.001, 0.01, 0.05, 0.1, 0.2, 0.4, 0.6, 0.8, 1) processed using ST-pipeline.<br> ``...
github_jupyter
# Federated Learning Training Plan: Host Plan & Model Here we load Plan and Model params created earlier in "Create Plan" notebook, host them to PyGrid, and run sample syft.js app that executes them. ``` %load_ext autoreload %autoreload 2 import websockets import json import base64 import requests import torch impo...
github_jupyter
## Prerequisites This notebook contains examples which are expected *to be run with exactly 4 MPI processes*; not because they wouldn't work otherwise, but simply because it's what their description assumes. For this, you need to: * Install an MPI distribution on your system, such as OpenMPI, MPICH, or Intel MPI (if ...
github_jupyter
``` import os import jieba import re import pandas as pd import numpy as np from sklearn.metrics.pairwise import cosine_similarity from sklearn.feature_extraction.text import CountVectorizer ``` ## 读数据 ``` df=pd.read_csv('./data/biquge_2500.csv',encoding='UTF-8-sig') df.head() ``` ## 获得id和标题2id的字典 ``` df['id']=np.a...
github_jupyter
``` # Imports import numpy as np import torch from phimal_utilities.data import Dataset from phimal_utilities.data.burgers import BurgersDelta from phimal_utilities.analysis import load_tensorboard from DeePyMoD_SBL.deepymod_torch.library_functions import library_1D_in from DeePyMoD_SBL.deepymod_torch.DeepMod import ...
github_jupyter
``` """ A randomly connected network learning a sequence This example contains a reservoir network of 500 neurons. 400 neurons are excitatory and 100 neurons are inhibitory. The weights are initialized randomly, based on a log-normal distribution. The network activity is stimulated with three different inputs (A, B, ...
github_jupyter
# Transformação de Fontes Jupyter Notebook desenvolvido por [Gustavo S.S.](https://github.com/GSimas) **Transformação de fontes é o processo de substituir uma fonte de tensão vs em série com um resistor R por uma fonte de corrente is em paralelo com um resistor R, ou vice-versa.** Assim como na transformação estrela...
github_jupyter
# Computingthe mean of a bunch of images: ``` # computing statistics: import torch from torchvision import transforms, datasets import numpy as np import time unlab_ddset = datasets.ImageFolder('./surrogate_dataset/unlab_dataset_055/train_set/', transform = transforms.Compose([tran...
github_jupyter
### Bouns: Difference of proportions Another simple way to calculate distinctive words in two texts is to calculate the words with the highest and lowest difference or proportions. In theory frequent words like 'the' and 'of' will have a small difference. In practice this doesn't happen. To demonstrate this we will r...
github_jupyter
# Experimental design and pattern estimation This week's lab will be about the basics of pattern analysis of (f)MRI data. We assume that you've worked through the two Nilearn tutorials already. Functional MRI data are most often stored as 4D data, with 3 spatial dimensions ($X$, $Y$, and $Z$) and 1 temporal dimension...
github_jupyter
# Policy compared to Covid-19 Case Rate All the typical caviates apply... - for example testing goes up through time... so case rate is skewed through time ## Bring in df and aggregate to index by date for all of UK ``` import numpy as np import pandas as pd df = pd.read_csv('cases_analysis.csv') df.drop(column...
github_jupyter
<h1>Logistic Regression</h1> Notebook Goals * Learn how to create a logistic regression model using scikit-learn <h2> What are some advantages of logistic regression?</h2> How do you create a logistic regression model using Scikit-Learn? The first thing you need to know is that despite the name logistic regression ...
github_jupyter
## <font color=black>sutils</font> **Change default region**: Use the `sutils.reset_profiles()` method and a prompt will appear with options and ask you to select a default region and AMI. Use the `price_increase` argument to set the maximum bid for each instance. This number will multiple the lowest spot-instance ...
github_jupyter
``` import os import pandas as pd filepath_old = '/media/sf_VBox_Shared/Arabic/Fiqh/2018-04-24-Fiqh/Fiqh' filepath_new = '/media/sf_VBox_Shared/Arabic/Fiqh/2018-06-08-Fiqh/' def get_metadata(filepath): metadata_dict = {} for filename in os.listdir(filepath): with open(os.path.join(filepath, filena...
github_jupyter
# USGS Historical Earthquake Events I'm querying the US Geological Service Common Catalog (ComCat) through their API [here](https://github.com/usgs/libcomcat). It works with bounding boxes, not particular countries, so ran three different downloads for bounding boxes around the Lower 48 states, Alaska, and Hawaii. I'...
github_jupyter
``` import copy from collections import deque from rdkit.Chem.Draw import IPythonConsole import torch import torch.nn as nn from torch.utils.tensorboard import SummaryWriter from rdkit import Chem from rdkit.Chem import RWMol from enviroment.ChemEnv import ChemEnv from enviroment.Utils import mol_to_graph_full fro...
github_jupyter
[Reinforcement Learning TF-Agents](https://colab.research.google.com/drive/1FXh1BQgMI5xE1yIV1CQ25TyRVcxvqlbH?usp=sharing) ``` import tensorflow as tf from tensorflow import keras import numpy as np import matplotlib as mpl from matplotlib import pyplot as plt # nice plot figures mpl.rc('axes', labelsize=14) mpl.rc('x...
github_jupyter
# A quick introduction to Blackjax BlackJAX is an MCMC sampling library based on [JAX](https://github.com/google/jax). BlackJAX provides well-tested and ready to use sampling algorithms. It is also explicitly designed to be modular: it is easy for advanced users to mix-and-match different metrics, integrators, traject...
github_jupyter
# Curso de introducción a Python: procesamiento y análisis de datos La mejor forma de aprender a programar es haciendo algo útil, por lo que esta introducción a Python se centrará alrededor de una tarea común: el _análisis de datos_. En este taller práctico se hará un breve repaso a los conceptos básicos de programaci...
github_jupyter
<a href="https://colab.research.google.com/github/roupenminassian/Freelance/blob/main/NLP%20(Logistic_Regression)%20for%20Twitter%20Event%20Prediction.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 import ...
github_jupyter
# NLP model creation and training ``` from fastai.gen_doc.nbdoc import * from fastai.text import * ``` The main thing here is [`RNNLearner`](/text.learner.html#RNNLearner). There are also some utility functions to help create and update text models. ## Quickly get a learner ``` show_doc(language_model_learner) ``` ...
github_jupyter
## KMEANS CLUSTERING Project follows the CRISP-DM Process while analyzing their data. PROBLEM : PREDICT THE CLUSTER OF CUSTOMERS BASED ON ANNUAL INCOME AND SPENDING TO BRING VALUABLE INSIGHTS FOR THE MALL. ## Questions : ## 1.Which cluster has both spending good score and income? ## 2.On which cluster should compa...
github_jupyter
# HyperParameter Tuning ### `keras.wrappers.scikit_learn` Example adapted from: [https://github.com/fchollet/keras/blob/master/examples/mnist_sklearn_wrapper.py]() ## Problem: Builds simple CNN models on MNIST and uses sklearn's GridSearchCV to find best model ``` import numpy as np np.random.seed(1337) # for rep...
github_jupyter
### Keras implementation of Brain CNN ``` import tensorflow as tf import numpy as np import sklearn.metrics from keras.utils.np_utils import to_categorical from keras.models import Sequential from keras.layers import Dense, Activation, Flatten from keras.layers.convolutional import Convolution2D, Conv2D from keras....
github_jupyter
``` import pandas as pd import numpy as np from tqdm.auto import tqdm import sys sys.path.insert(1, '../oracle-polimi-contest-2019') from evaluation_script import read_file from collections import Counter import similaripy as sim from scipy import * from scipy.sparse import * import string import unidecode def create_...
github_jupyter
### Creating superposition states associated with discretized probability distributions #### Prerequisites Here are a few things you should be up to speed on before we start: - [Python fundamentals](https://qiskit.org/textbook/ch-prerequisites/python-and-jupyter-notebooks.html) - [Programming quantum computers using...
github_jupyter
``` # Install old version of scikit-learn, see https://github.com/SeldonIO/seldon-core/issues/2059 !pip install -UIv scikit-learn==0.20.3 !pip install azure-storage-file-datalake azure-identity azure-storage-blob pandas joblib ### ENTER YOUR DETAILS ### storage_account_name = "" client_id = "" tenant_id = "" client_s...
github_jupyter
#python deep_dream.py path_to_your_base_image.jpg prefix_for_results #python deep_dream.py img/mypic.jpg results/dream #from __future__ import print_function from tensorflow import keras import numpy as np import argparse from keras.applications import inception_v3 from keras import backend as K from keras.preproc...
github_jupyter
# T81-558: Applications of Deep Neural Networks **Module 14: Other Neural Network Techniques** * 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 th...
github_jupyter
# Implementing AdaBoost When the trees in the forest are trees of depth 1 (also known as decision stumps) and we perform boosting instead of bagging, the resulting algorithm is called AdaBoost. AdaBoost adjusts the dataset at each iteration by performing the following actions: - Selecting a decision stump - Increasin...
github_jupyter
# List Comprehensions Lab Complete the following set of exercises to solidify your knowledge of list comprehensions. ``` import os import numpy as np import pandas as pd ``` ### 1. Use a list comprehension to create and print a list of consecutive integers starting with 1 and ending with 50. ### 2. Use a list compr...
github_jupyter
# An Introduction to FEAST v2.0 FEAST v2.0 is a Python implementation of the Fugitive Emmissions Abatement Simulation Toolkit (FEAST) published by the Environmental Assessment and Optimization group at Stanford University. FEAST v2.0 generates similar results to FEAST v1.0 and includes some updates to the code structu...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '1' os.environ['CUDA_DEVICE_ORDER']='PCI_BUS_ID' import torch from allennlp.nn import util import sys sys.path.insert(0, "../../gector") sys.path.insert(0, "../../") from gector.gec_model import GecBERTModel vocab_path = "../../data/output_vocabulary" model_paths = "....
github_jupyter
``` import types def all_saptak(): names = ["Sa", "Re_", "Re", "Ga_", "Ga", "Ma", "Ma__", "Pa", "Dha_", "Dha", "Ni_", "Ni"] mandra = [n.lower() for n in names] tar = [n.upper() for n in names] return tuple(mandra + names + tar) def window(item, items, width=7): index = items.index(item) start...
github_jupyter
# AIMSim Demo This notebook demonstrates the key uses of _AIMSim_ as a graphical user interface, command line tool, and scripting utility. For detailed explanations and to view the source code for _AIMSim_, visit our [documentation page](https://vlachosgroup.github.io/AIMSim/). ## Installing _AIMSim_ For users with Py...
github_jupyter
# Section 3.3 Single Model Numerical Diagnostics ``` import os import arviz as az # Change working directory if os.path.split(os.getcwd())[-1] != "notebooks": os.chdir(os.path.join("..")) NETCDF_DIR = "inference_data" az.style.use('arviz-white') ``` ## What happened to hard numbers? One criticism of visual pl...
github_jupyter
# Part 2 - Refine Data The second step for analyzing the data is to perform some additional preparations and enrichments. While the first step of storing the data into the structured zone should be mainly a technical conversion without losing any information, this next step will integrate some data and also preaggrega...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline from __future__ import division import pandas as pd V = np.linspace(0,1000,1000) plt.plot(V, 6.43 - 5e-14*(np.exp(V/2.6) - 1)) #in V and A plt.ylim(0,10) plt.xlim(0,100) V = np.linspace(0,100,1000) I_o = 5e-14 #A I_L = 6.43 #A R_s = 0 #ohm R_sh =...
github_jupyter
# Amazon SageMaker Processing と AWS Step Functions Data Science SDK で機械学習ワークフローを構築する Amazon SageMaker Processing を使うと、データの前/後処理やモデル評価のワークロードを Amazon SageMaker platform 上で簡単に実行することができます。Processingジョブは Amazon Simple Storage Service (Amazon S3) から入力データをダウンロードし、処理結果を Amazon S3 にアップロードします。 Step Functions SDK は AWS Step Fu...
github_jupyter
This notebook is designed to run in a IBM Watson Studio default runtime (NOT the Watson Studio Apache Spark Runtime as the default runtime with 1 vCPU is free of charge). Therefore, we install Apache Spark in local mode for test purposes only. Please don't use it in production. In case you are facing issues, please re...
github_jupyter
``` import tensorflow from math import sqrt from numpy import concatenate from matplotlib import pyplot from pandas import read_csv from pandas import DataFrame from pandas import concat from sklearn.preprocessing import MinMaxScaler from sklearn.preprocessing import LabelEncoder from sklearn.metrics import mean_square...
github_jupyter
![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/machine-learning-pipelines/nyc-taxi-data-regression-model-building/nyc-taxi-data-regression-model-building.png) # NYC Taxi Data Regression Model This is an [Azure Machine Learning Pipelines](h...
github_jupyter
**Chapter 3 – Classification** _This notebook contains all the sample code and solutions to the exercices in chapter 3._ # Setup First, let's make sure this notebook works well in both python 2 and 3, import a few common modules, ensure MatplotLib plots figures inline and prepare a function to save the figures: ```...
github_jupyter
# Tutorial 7: Graph Neural Networks ![Status](https://img.shields.io/static/v1.svg?label=Status&message=Finished&color=green) **Filled notebook:** [![View on Github](https://img.shields.io/static/v1.svg?logo=github&label=Repo&message=View%20On%20Github&color=lightgrey)](https://github.com/phlippe/uvadlc_notebooks/bl...
github_jupyter
# Numerical Differentiation Teng-Jui Lin Content adapted from UW AMATH 301, Beginning Scientific Computing, in Spring 2020. - Numerical differentiation - First order methods - Forward difference - Backward difference - Second order methods - Central difference - Other second o...
github_jupyter
``` from typing import List from collections import defaultdict from functools import lru_cache class Solution: def catMouseGame(self, graph: List[List[int]]) -> int: @lru_cache(None) def dfs(mouse, cat, step): if step > len(graph) * 2: return 0 if cat == mou...
github_jupyter
``` import os os.chdir("../../scVI/") os.getcwd() import torch import pickle import seaborn as sns import numpy as np import pandas as pd from umap import UMAP from sklearn.cluster import SpectralClustering from scvi.inference import UnsupervisedTrainer from scvi.models import VAE save_path = '../CSF/Notebooks/' impor...
github_jupyter
``` import sys sys.path.append('/home/bibek/projects/DEEPL') from helpers.deep import get_deep_data, get_classifier #data = get_deep_data(debug=False, filepath='/home/bibek/projects/DEEPL/_playground/sample_data/nlp_out.csv') import pandas as pd df = pd.read_csv('/home/bibek/projects/DEEPL/_playground/sample_data/proc...
github_jupyter
#### Xl Juleoriansyah Nksrsb / 13317005 #### Muhamad Asa Nurrizqita Adhiem / 13317018 #### Oktoni Nur Pambudi / 13317022 #### Bernardus Rendy / 13317041 # Definisi Masalah #### Dalam tangki dengan luas permukaan A, luas luaran a, dalam percepatan gravitasi g [Parameter A,a,g] #### Diisi dengan flow fluida Vin (asumsi ...
github_jupyter
##### Copyright 2019 Qiyang Hu ``` #@title Licensed under MIT License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://huqy.github.io/idre_learning_machine_learning/LICENSE.md # # Unless required by applicable law or agreed to in ...
github_jupyter
# Simple ray tracing ``` # setup path to ray_tracing package import sys sys.path.append('~/Documents/python/ray_tracing/') import ray_tracing as rt from matplotlib import rcParams rcParams['figure.figsize'] = [8, 4] import matplotlib.pyplot as plt plt.ion() ``` ## Principle The package 'ray_tracing.py' provides yo...
github_jupyter
``` #default_exp utils ``` # Utility Functions > Utility functions to help with downstream tasks ``` #hide from nbdev.showdoc import * from self_supervised.byol import * from self_supervised.simclr import * from self_supervised.swav import * #export from fastai.vision.all import * ``` ## Loading Weights for Downstr...
github_jupyter
``` import numpy as np import pandas as pd from scipy import stats from statsmodels.stats.proportion import proportion_confint from statsmodels.stats.weightstats import CompareMeans, DescrStatsW, ztest from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklear...
github_jupyter
## How-to guide for Customer Churn use-case on Abacus.AI platform This notebook provides you with a hands on environment to build a customer churn prediction model using the Abacus.AI Python Client Library. We'll be using the [Telco Customer Churn Dataset](https://s3.amazonaws.com//realityengines.exampledatasets/custo...
github_jupyter