text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
## Vereadores mais votados do município do Rio de Janeiro por zona Esse programa lê o banco de dados oferecido pelo TSE para votações estaduais e seleciona os vereadores de um determinado município, filtrando apenas as variáveis desejadas, e gera um novo arquivo *.csv*. Esses dados podem ser encontrados no repositóri...
github_jupyter
## Import Required Packages ``` import tensorflow as tf import tensorflow_addons as tfa from tqdm import tqdm import pandas as pd import sklearn from sklearn import metrics import re import numpy as np import pickle as pkl import PIL import datetime import os import random import shutil import statistics import time i...
github_jupyter
Cross-validation is one among the foremost powerful tools of machine learning and every Data Scientist should be conversant in it. In real world , you can’t finish the project without cross-validating a model. However, It’s worth mentioning that sometimes performing cross-validation could be a touch tricky task. For e...
github_jupyter
<br> <br> <font size='6'><u><b>Gravitational Lensing</b></u></font> <br> _**Written by A. Bolton, 2017**_ _**Updated 2018: Elliot Kisiel and Connie Walker**_ _**Revised by Andres Jaramillo**_ You have learned about how we can measure the mass of a galaxy based on the gravitational lensing of a foreground galaxy. Th...
github_jupyter
# Array Compare $\psi_4$ data with low and high level MMRDNS Models ### Setup The Enviroment ``` # Low-level import from numpy import array,loadtxt,linspace,zeros,exp,ones,unwrap,angle,pi # Setup ipython environment %load_ext autoreload %autoreload 2 # %matplotlib inline # Import useful things from kerr from kerr....
github_jupyter
# Introduction Structured Query Language, or **SQL**, is the programming language used with databases, and it is an important skill for any data scientist. In this course, you'll build your SQL skills using **BigQuery**, a web service that lets you apply SQL to huge datasets. In this lesson, you'll learn the basics o...
github_jupyter
### Overall Strategy What is the **want** we want to plot the price of a product (brand/format) over the year, for one year. What we have done so far is identified the UPCs for a particular product (brand/format), now we just need to connect it with the scanner data set and work towards our want. Let me first discus...
github_jupyter
<a href="https://colab.research.google.com/github/Educat8n/Reinforcement-Learning-for-Game-Playing-and-More/blob/main/Module2/Module_2.1_Introduction_to_gym.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` # In colab please uncomment this to inst...
github_jupyter
# Skip-gram word2vec In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language processing. This will come in handy when dealing with things like machine translation....
github_jupyter
# Neste notebook vamos avaliar o atraso de grupo ``` # importar as bibliotecas necessárias import numpy as np # arrays import matplotlib.pyplot as plt # plots plt.rcParams.update({'font.size': 14}) import IPython.display as ipd # to play signals import sounddevice as sd import soundfile as sf # Os próximos módulos são...
github_jupyter
# Softmax exercise *Complete and hand in this completed worksheet (including its outputs and any supporting code outside of the worksheet) with your assignment submission. For more details see the [assignments page](http://vision.stanford.edu/teaching/cs231n/assignments.html) on the course website.* This exercise is ...
github_jupyter
# Pythonで基礎から機械学習 重回帰分析 今回は、前回の単回帰分析を読んだことを前提の内容となっております。ご了承ください。 重回帰分析は、単回帰分析の入力変数が1つだったのが、複数(n)になったものです。それにより、単回帰から、以下のような変化があります。 - 行列を使った計算が増える(複雑になる) - 複数の入力変数の粒度を揃えるために正規化が必要 - 単回帰と同様の計算に対して、入力変数の数に応じた補正が必要になる場合がある - 入力変数同士の相関が強い(線形従属)の場合は、うまくモデル化できないので、正則化・次元削減といった対策が必要  これらに注意して、実際に手を動かしながら確認していきましょう。 ## デ...
github_jupyter
# Apartado 3 - Bucles - Iteraciones | `for` - `range` & `enumerate` - `while` - `break` & `continue` -------------------------------------------------------------------------------------- ## Iteraciones | bucle `for` ``` lista = ["red", 2, "blue", 4.0] lista2 = [2, 4, 6, 8, 10, 12, 9518591859] for x in lista2: ...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.o...
github_jupyter
``` import numpy as np import pandas as pd import torch import torchvision from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from matplotlib import pyplot as plt %matplotlib inline torch.backends...
github_jupyter
# Dispersion By Evgenia "Jenny" Nitishinskaya and Delaney Granizo-Mackenzie Notebook released under the Creative Commons Attribution 4.0 License. --- Dispersion measures how spread out a set of data is. This corresponds to risk when our data set is returns over time. Data with low dispersion is heavily clustered arou...
github_jupyter
# Audio Playback and Recording [back to main page](../index.ipynb) There are many libraries for audio playback and/or recording available for Python. They greatly differ in features, API, requirements, quality, ... This is just a random selection. See also https://wiki.python.org/moin/Audio and https://wiki.python....
github_jupyter
# Queue Runners ``` import tensorflow as tf ``` ## Import csv files <hr/> ### first ```python filename_queue = tf.train.string_input_producer(['data-01-test-score.csv', 'data-02-stock_daily.csv', 'data-03-diabetes.csv'...
github_jupyter
# Norman 2019 Training Demo ``` import sys #if branch is stable, will install via pypi, else will install from source branch = "stable" IN_COLAB = "google.colab" in sys.modules if IN_COLAB and branch == "stable": !pip install cpa-tools elif IN_COLAB and branch != "stable": !pip install --quiet --upgrade jsons...
github_jupyter
``` # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load in import numpy as np # linear algebra import pandas as pd # data processing, CSV file...
github_jupyter
# MINI PROJECT 1 ``` # solusi tanpa menggunakan set def remove_duplicate(obj_list): temp = sorted(obj_list) new_list = [] for i in temp: if i not in new_list: new_list.append(i) return new_list # solusi dengan menggunakan set def remove_duplicate_with_set(obj_list): new_list =...
github_jupyter
``` # %pip install iteround # %pip install pairing # %pip install scikit-multilearn # %pip install arff # %pip install category_encoders import sys sys.path.append("../") from bandipy import simulation import numpy as np ## For synthetic data generation import keras from keras.models import Sequential from keras.layers...
github_jupyter
# Data wrangling This notebook is adapated from Joris Van den Bossche tutorial: * https://github.com/paris-saclay-cds/python-workshop/blob/master/Day_1_Scientific_Python/02-pandas_introduction.ipynb ``` %matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt pd.options.display.max_...
github_jupyter
``` # reload packages %load_ext autoreload %autoreload 2 ``` ### Choose GPU (this may not be needed on your computer) ``` %env CUDA_DEVICE_ORDER=PCI_BUS_ID %env CUDA_VISIBLE_DEVICES=1 ``` ### load packages ``` from tfumap.umap import tfUMAP import tensorflow as tf import numpy as np import matplotlib.pyplot as plt ...
github_jupyter
``` # Run the command below if necessary, for example with Google Colab #!python3 -m pip install mxnet-cu110 # Global Libs import matplotlib.pyplot as plt import mxnet as mx import numpy as np import pandas as pd import pickle import random from sklearn import datasets, metrics # Local libs import model with open("cla...
github_jupyter
# Custom TF-Hub Word Embedding with text2hub **Learning Objectives:** 1. Learn how to deploy AI Hub Kubeflow pipeline 1. Learn how to configure the run parameters for text2hub 1. Learn how to inspect text2hub generated artifacts and word embeddings in TensorBoard 1. Learn how to run TF 1.x generated hub module...
github_jupyter
## Download Future Contract data Make sure to download this file only once after market closing. No need to run the cells more than once otherwise multiple files may get created. ``` from datetime import date from nsepy import get_history import pandas as pd import os import datetime import tqdm exdates = pd.read_csv...
github_jupyter
## Documentation: * https://snap.stanford.edu/snappy/doc/index.html ## Data: * http://snap.stanford.edu/data/wiki-Vote.html * http://snap.stanford.edu/class/cs224w-data/hw0/stackoverflow-Java.txt.gz ``` import snap import matplotlib.pyplot as plt import pandas as pd import numpy as np from collections import defaultd...
github_jupyter
# Введение в математику для МЛ ``` import numpy as np import scipy as sc ``` ### Вектор Вектор $\mathbf{v}$ (или $\vec{v}$) - это элемент векторного пространства $\mathrm{V}$. Для него определены операции сложения друг с другом и умножения на число (скаляр). Эти операции подчинены аксиомам, которые мы скоро увидим...
github_jupyter
``` %matplotlib notebook # use ``%matplotlib widget`` in Jupyter Lab import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import LogNorm import pathlib import os import pwd def get_home(): return os.path.expanduser("~") home = get_home() run_dir = pathlib.Path(rf"{home}/LEC/") #path to your ...
github_jupyter
## Content Based Filtering by hand This lab illustrates how to implement a content based filter using low level Tensorflow operations. The code here follows the technique explained in Module 2 of Recommendation Engines: Content Based Filtering. ``` !pip install tensorflow==2.1 ``` Make sure to restart your kernel ...
github_jupyter
Deep Learning Models -- A collection of various deep learning architectures, models, and tips for TensorFlow and PyTorch in Jupyter Notebooks. - Author: Sebastian Raschka - GitHub Repository: https://github.com/rasbt/deeplearning-models ``` %load_ext watermark %watermark -a 'Sebastian Raschka' -v -p torch ``` - Runs ...
github_jupyter
# Errori di sintassi ed eccezioni # In python possono capitare due tipi di errori principalmente: - Errori di sintassi : errori dovuti alla scrittura sbagliata di comandi nel codice - eccezioni : errori la cui natura è logica e non simile alla precedente Fortunatamente python fornisce dei possibili metodi per risolvere...
github_jupyter
``` !pip install html2text #ONLY if html2text not installed import numpy as np import pandas as pd from __future__ import print_function import sys import io import random # NLP and text from html2text import html2text import re import string import nltk from nltk.data import find import gensim from gensim.models impo...
github_jupyter
# OSM COMPETITION: A Meta Model that optimally combines the outputs of other models. The aim of the competition is to develop a computational model that predicts which molecules will block the malaria parasite's ion pump, PfATP4. Submitted by James McCulloch - james.duncan.mcculloch@gmail.com ## Final Results. The D...
github_jupyter
``` import numpy as np import scipy import matplotlib import pandas as pd from numpy import genfromtxt import json import sys import pandas import matplotlib.pyplot as plt import os %matplotlib inline # os.environ["PATH"] += os.pathsep + '/usr/local/texlive/2019/bin/x86_64-darwin' print(os.getenv("PATH")) lgndsize = '...
github_jupyter
# Components of StyleGAN ### Goals In this notebook, you're going to implement various components of StyleGAN, including the truncation trick, the mapping layer, noise injection, adaptive instance normalization (AdaIN), and progressive growing. ### Learning Objectives 1. Understand the components of StyleGAN that...
github_jupyter
``` %run Common.ipynb import numpy as np import matplotlib.pyplot as plt from azure.cognitiveservices.vision.customvision.training import CustomVisionTrainingClient from azure.cognitiveservices.vision.customvision.training.models import ImageFileCreateEntry from PIL import Image, ImageFilter %matplotlib inline ``` ##...
github_jupyter
# Pipeline In this part, we present the originally complex steps using the way of pipeline. Due to the complexity of the project, we needed to customize more functions for functional implementation. ### Predefined function This section contains all of the functionality we implemented earlier. We show all the functions...
github_jupyter
``` #r "nuget:Microsoft.Data.Analysis,0.1.0" using Microsoft.Data.Analysis; PrimitiveDataFrameColumn<DateTime> dateTimes = new PrimitiveDataFrameColumn<DateTime>("DateTimes"); // Default length is 0. PrimitiveDataFrameColumn<int> ints = new PrimitiveDataFrameColumn<int>("Ints", 3); // Makes a column of length 3. Filled...
github_jupyter
``` #imports from datasets import load_dataset, load_metric from sklearn.metrics import accuracy_score, precision_recall_fscore_support from transformers import AutoTokenizer from transformers import AutoModelForSequenceClassification, TrainingArguments, Trainer from thai2transformers.preprocess import process_transfor...
github_jupyter
# SIFTS Data Demo This demo shows how to query PDB annotations from the SIFTS project. The "Structure Integration with Function, Taxonomy and Sequence" is the authoritative source of up-to-date residue-level annotation of structures in the PDB with data available in Uniprot, IntEnz, CATH, SCOP, GO, InterPro, Pfam and...
github_jupyter
# Deploying pre-trained PyTorch vision models with Amazon SageMaker Neo Neo is a capability of Amazon SageMaker that enables you to compile machine learning models to optimize them for our choice of hardward targets. Currently, Neo supports pre-trained PyTorch models from [TorchVision](https://pytorch.org/docs/stable/...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib notebook plt.style.use('seaborn-notebook') #The Fuel of the system, DATASETS! df1 = pd.read_csv('F:/Akshay Files/DataSets/kanpur.csv') df0 = pd.read_csv('F:/Akshay Files/DataSets/bengaluru.csv') #what does it look like df0.tail() #C...
github_jupyter
``` import json from dateutil.parser import parse import pprint f = open('../data/fhir/Abe604_Veum823_e841a5e8-9ace-437b-be32-b37d006aef87.json', 'r') text = f.read() f.close() print(type(text)) with open('../data/fhir/Abe604_Veum823_e841a5e8-9ace-437b-be32-b37d006aef87.json') as f: bundle = json.load(f) print(type...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Algorithms/CloudMasking/modis_surface_reflectance_qa_band.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td...
github_jupyter
# ISB-CGC Community Notebooks Check out more notebooks at our [Community Notebooks Repository](https://github.com/isb-cgc/Community-Notebooks)! ``` Title: How to make t-SNE and UMAP plots Author: David L Gibbs Created: 2019-10-15 Purpose: Demonstrate how to perform dimension reduction with PCA, t-SNE, and UMAP, an...
github_jupyter
## Using Scikit-Learn and NLTK to build a Naive Bayes Classifier that identifies subtweets #### In all tables, assume: * "➊" represents a single URL * "➋" represents a single mention of a username (e.g. "@noah") * "➌" represents a single mention of an English first name #### Import libraries ``` %matplotlib inline f...
github_jupyter
# A step-by-step look at the Simulation class The simplest way to solve a model is to use the `Simulation` class. This automatically processes the model (setting of parameters, setting up the mesh and discretisation, etc.) for you, and provides built-in functionality for solving and plotting. Changing things such as pa...
github_jupyter
``` from pydgrid import grid from pydgrid.pydgrid import phasor2time, pq from pydgrid.pf import pf_eval,time_serie from pydgrid.electric import bess_vsc, bess_vsc_eval from pydgrid.simu import simu, f_eval, ini_eval, run_eval import matplotlib.pyplot as plt import numpy as np plt.style.use('presentation.mplstyle') # co...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content-dl/blob/main/tutorials/W1D3_MultiLayerPerceptrons/W1D3_Tutorial2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Tutorial 2: Deep MLPs **Week 1, Day 3: Multi Layer...
github_jupyter
<center> <img src="https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-DA0101EN-SkillsNetwork/labs/Module%205/images/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # Model Evaluation and Refinement Estimated time needed: **30** minutes ## Objectives ...
github_jupyter
``` import pandas as pd import numpy as np from matplotlib import pyplot as plt import seaborn as sns import geopandas as gpd %matplotlib inline from urbansim_templates import modelmanager as mm from urbansim_templates.models import LargeMultinomialLogitStep import orca import os; os.chdir('../') import warnings;warnin...
github_jupyter
``` # to run the script, you need to start pathway tools form the command line # using the -lisp -python options. Example (from the pathway tools github repository) import os # os.system('nohup /opt/pathway-tools/pathway-tools -lisp -python &') os.system('nohup pathway-tools -lisp -python-local-only &') # added cyber...
github_jupyter
# Enabling App Insights for Services in Production With this notebook, you can learn how to enable App Insights for standard service monitoring, plus, we provide examples for doing custom logging within a scoring files in a model. ## What does Application Insights monitor? It monitors request rates, response times, f...
github_jupyter
``` from random import seed from random import randrange from csv import reader def load_csv(filename): dataset = list() with open(filename, 'r') as file: csv_reader = reader(file) for row in csv_reader: if not row: continue dataset.append(row) return dataset def str_column_to_float(dataset, column...
github_jupyter
``` # for numbers import xarray as xr import numpy as np import pandas as pd # for figures import matplotlib as mpl import matplotlib.pyplot as plt import cartopy.crs as ccrs # An "anonymous function" to print the max value of an Xarray DataArray printMax = lambda x: print(np.asscalar(x.max().values)) def quick_map(lo...
github_jupyter
``` import pandas as pd from matplotlib import pyplot as plt import os ``` # Preparation ## Get T1 image 18 controls and 11 patients. All images are bias corrected using fsl_anat. ``` !ls *.nii.gz # check images # !slicesdir `imglob *` ``` ## Create template list choose 11 control's image and 11 patient's iamge ```...
github_jupyter
# Locate P, Q, S and T waves in ECG This example shows how to use Neurokit to delineate the ECG peaks in Python using NeuroKit. This means detecting and locating all components of the QRS complex, including **P-peaks** and **T-peaks**, as well their **onsets** and **offsets** from an ECG signal. ``` # Load NeuroKit a...
github_jupyter
# CNT orientation detection using TDA The following shows scanning electron microscopy (SEM) images of carbon nanotube (CNT) samples of different alignment degree. <table><tr> <td> <img src="SEM/00.PNG" style="width:100%"/> </td> <td> <img src="SEM/10.PNG" style="width:100%"/> </td> </tr></table> <table><tr> ...
github_jupyter
在这个教程中,你将会学到如何使用python的pandas包对出租车GPS数据进行数据清洗,识别出行OD <div class="alert alert-info"><h2>提供的基础数据是:</h2><p> 数据:<br> 1.出租车原始GPS数据(在data-sample文件夹下,原始数据集的抽样500辆车的数据)</p></div> [pandas包的简介](https://baike.baidu.com/item/pandas/17209606?fr=aladdin) # 读取数据 首先,读取出租车数据 ``` import pandas as pd #读取数据 data = pd.read_cs...
github_jupyter
``` %load_ext autoreload %autoreload 2 %matplotlib inline from argparse import Namespace import pbio.misc.logging_utils as logging_utils args = Namespace() logger = logging_utils.get_ipython_logger() import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns; sns.set(style='white') ...
github_jupyter
## SON Burda yapılan tüm işlemler özetlenerek tek bir dataframe üzerinde performans testleri yapıldı. Diğer .ipynb uzantılı sayfalarda ise burdaki algoritmalar açıklandı. ``` import nltk # Python un NLP kütüphanesini ekledik from nltk.corpus import twitter_samples # Twitter veriseti...
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
<a href="https://colab.research.google.com/github/livinNector/deep-learning-tools-lab/blob/main/3%20-%20Deep%20Neural%20Networks.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # 3 - Deep Neural Networks ## Classification using Deep Neural Networks...
github_jupyter
# Loading packages ``` import numpy as np import matplotlib.pyplot as plt import pandas as pd import statsmodels.api as sm from scipy.stats import norm,gamma,lognorm,pareto,spearmanr,pearsonr import seaborn as sns from scipy.interpolate import interp1d import itertools #from matplotlib import colors plt.style.use('ggp...
github_jupyter
``` import numpy as np import pandas as pd from matplotlib import pyplot as plt from tqdm import tqdm as tqdm %matplotlib inline import torch import torchvision import torchvision.transforms as transforms import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import random transform = trans...
github_jupyter
# sanity checks on `models.NMF` with emulator ``` import numpy as np from provabgs import models as Models # --- plotting --- import corner as DFM import matplotlib as mpl import matplotlib.pyplot as plt mpl.rcParams['text.usetex'] = True mpl.rcParams['font.family'] = 'serif' mpl.rcParams['axes.linewidth'] = 1.5 mpl...
github_jupyter
# Encoders: Binary Example One of the interesting Neural Net Architectures are auto-encoders. Auto-encoders are networks designed to predict their own input. An auto-encoder consists of an `encoder` which encodes the input to a set of __latent variables__ and a `decoder` which decodes the latent variables and tries to ...
github_jupyter
``` import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import seaborn as sns import random import time import collections from tqdm import tqdm from tensor2tensor.utils import beam_search sns.set() with open('shakespeare.txt') as fopen: shakespeare = fopen.read() char2idx = {c: i+3 for i, c ...
github_jupyter
# How to generate text: using different decoding methods for language generation with Transformers https://huggingface.co/blog/how-to-generate ``` !pip install -q git+https://github.com/huggingface/transformers.git !pip install -q tensorflow import tensorflow as tf from transformers import TFGPT2LMHeadModel, GPT2Token...
github_jupyter
<a href="https://colab.research.google.com/github/PUC-RecSys-Class/RecSysPUC-2020/blob/master/practicos/pyRecLab_iKNN.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Práctica de Sistemas Recomendadores: pyreclab - iKNN En este tutorial vamos a ut...
github_jupyter
``` import tensorflow as tf import numpy as np import pandas as pd import math import matplotlib.pyplot as plt import matplotlib.image as mpimg import seaborn as sns from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Con...
github_jupyter
# DMFT calculation with IPT Author: [Fumiya KAKIZAWA](mailto:f.kakizawa.178@ms.saitama-u.ac.jp), [Rihito SAKURAI](mailto:sakurairihito@gmail.com), [Hiroshi SHINAOKA](mailto:h.shinaoka@gmail.com) ## Theory ### Self-consistent equation We will solve the Hubbard model using the dynamical mean-field theory (DMFT) [1]. We...
github_jupyter
# Preface The locations requiring configuration for your experiment are commented in capital text. # Setup **Installations** ``` !pip install apricot-select !pip install sphinxcontrib-napoleon !pip install sphinxcontrib-bibtex !git clone https://github.com/decile-team/distil.git !git clone https://github.com/circu...
github_jupyter
# Single-cell RNA-seq analysis workflow using Scanpy on CPU Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. NVIDIA CORPORATION and its licensors retain all intellectual property and proprietary rights in and to this software, related documentation and any modifications thereto. Any use, reproduction, d...
github_jupyter
![Institute of Coding](assets/header.png) # Introduction Welcome to the first example of **Data Science for Everyone**. The following example will be about introduction to data visualization with **Python** and plotting line charts. In the introductory examples, we'll use Google's CoLab which provides all the libr...
github_jupyter
# The Electron Collection The electron collection is a lot like the jet collection other than there are working points (loose, medium, tight) that are defined by the Egamma working group. Accessing the collection is similar, at first blush, to the jet collection. ``` import matplotlib.pyplot as plt from config impor...
github_jupyter
## Nonlinear Sturm-Liouville Operator ### Formulation: $L[u(x)] = f(x) \qquad x \in [0,10]$ $-[p(x) \; u_{x}]_{x} + q(x) \; u(x) + \alpha \; q(x) \; u^2(x) = f(x)$ $p(x) = 0.5 \; sin(x) + 0.1 \; sin(11 x) + 0.25 \; cos(4 x) + 3$ $q(x) = 0.6 \; sin(x+1) + 0.3 \; sin(2.5 x) + 0.2 \; cos(5x) + 1.5$ $\alpha = 0.4$ ...
github_jupyter
``` from pandas_datareader import data, wb ##Data reader to read data from web import pandas as pd import numpy as np import datetime import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline ``` # Data **Name (DataFrame Name)** <input type="checkbox"> Bank of America (BAC) <input type="checkbox...
github_jupyter
``` #r "nuget: TorchSharp-cpu" open TorchSharp open type TorchSharp.TensorExtensionMethods open type TorchSharp.torch.distributions open Microsoft.DotNet.Interactive.Formatting let style = TensorStringStyle.Julia Formatter.SetPreferredMimeTypesFor(typeof<torch.Tensor>, "text/plain") Formatter.Register<torch.Tensor>...
github_jupyter
``` import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv), data manipulation as in SQL import matplotlib matplotlib.use("Agg") %matplotlib inline # used for plot interactive graph. I like it most for plot import seaborn as sns # this is used for the plot the graph from sklearn.model_selection import t...
github_jupyter
<img src="../images/aeropython_logo.png" alt="AeroPython" style="width: 300px;"/> # Introducción a la sintaxis de Python III: funciones _En esta clase continuaremos con nuestra introducción a Python. Lo más importante para programar, y no solo en Python, es saber organizar el código en piezas más pequeñas que hagan t...
github_jupyter
``` import os import datetime from dotenv import load_dotenv import pandas as pd import altair as alt pd.options.display.max_rows = 50 WIDTH = 650 from IPython.display import Markdown from IPython.core.magic import register_cell_magic @register_cell_magic def markdown(line, cell): return Markdown(cell.format(**glo...
github_jupyter
# DIET PROBLEM - PYOMO *Zuria Bauer Hartwig* ( [CAChemE](http://cacheme.org)) Original Problem: [Linear and Integer Programming](https://www.coursera.org/course/linearprogramming) (Coursera Course) - University of Colorado Boulder & University of Colorado System Based on the Examples from the Optimization Course = [...
github_jupyter
``` import torch import pandas as pd import matplotlib.pyplot as plt import os import subprocess import numpy as np os.chdir("/home/jok120/sml/proj/attention-is-all-you-need-pytorch/") basic_train_cmd = "/home/jok120/build/anaconda3/envs/pytorch_src2/bin/python " +\ "~/sml/proj/attention-is-all-you-ne...
github_jupyter
``` %load_ext autoreload %autoreload 2 import sys sys.path.append("..") from optimus import Optimus op = Optimus("dask_cudf", comm=True) df = op.load.csv("https://raw.githubusercontent.com/ironmussa/Optimus/master/examples/data/foo.csv", sep=",", header=True, infer_schema='true', charset="UTF-8").ext.cache() df.ext.dis...
github_jupyter
# SN1 & SN2 Fitting SN1 and SN2 cubes is very similar to fitting SN# cubes with one exception -- the machine learning algorithm used to estimate the velocity and broadening was trained on SN3, and, therefore, we cannot use it estimate these parameters in other data cubes. Thus, I have implemented another basic algorit...
github_jupyter
``` from stepPlay import * import numpy as np import copy def prn_obj(obj): print('\n'.join(['%s:%s' % item for item in obj.__dict__.items()])) def softmax(x): probs = np.exp(x - np.max(x)) probs /= np.sum(probs) return probs n = 5 width, height = 8, 8 model_file = 'best_policy_8_8_5.model' board = ...
github_jupyter
# Data description & Problem statement: I will use the Yelp Review Data Set from Kaggle. Each observation in this dataset is a review of a particular business by a particular user. The "stars" column is the number of stars (1 through 5) assigned by the reviewer to the business. (Higher stars is better.) In other words...
github_jupyter
# StateLegiscraper: Audio Format Example Notebook *Author*: Katherine Chang (kachang@uw.edu) *Last Updated*: 1/3/2022 StateLegiscraper is a Python package that scrapes and processes data from U.S. state legislature websites. As of writing, the package is focused on transcribing standing committee hearings from each ...
github_jupyter
For MS training we have 3 datasets: train, validation and holdout ``` import numpy as np import pandas as pd import nibabel as nib from scipy import interp from sklearn.utils import shuffle from sklearn.model_selection import GroupShuffleSplit from sklearn.metrics import confusion_matrix, roc_auc_score, roc_curve, au...
github_jupyter
``` import sympy from sympy import symbols , solve x = symbols('x') expr = x -4 - 2 sol = solve(expr) sol num=sol[0] num from sympy import symbols , solve, Eq y = symbols('y') eq1 = Eq(y + 3 + 8, 0) sol = solve(eq1) sol y = symbols('x') eq1 = Eq(3*x**2 - 5*x + 6, 0) sol = solve(eq1,dict=True) sol from sympy...
github_jupyter
## Data Loading Tutorial Loading data is one crucial step in the deep learning pipeline. PyTorch makes it easy to write custom data loaders for your particular dataset. In this notebook, we're going to download and load cifar-10 dataset and return a torch "tensor" as the image and the label. ## Getting the dataset H...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import yfinance as yf import scipy from sklearn.neighbors import KernelDensity from scipy.interpolate import CubicSpline %matplotlib inline sns.set() import xlrd xlrd.xlsx.ensure_elementtree_imported(False, None) xlrd.xlsx...
github_jupyter
``` %matplotlib inline #import matplotlib #matplotlib.use('tkAgg') import matplotlib.pyplot as plt import sys import math import numpy as np import scipy as sp import scipy.optimize import scipy.misc import scipy.special EUR_DECIMALS = 10**18 NMK_DECIMALS = 10**18 CAP = 15 * 10**8 S = -6.5 def issued(cummulative_euros)...
github_jupyter
``` import matplotlib import numpy as np from scipy import stats # matplotlib.use("macosx") import matplotlib.pyplot as plt #f = open("/Users/jeff/Research/Simcore/diffusion_len_10_2d.log",'r') #f = open("/Users/jeff/Research/Simcore/diffusion_len_10_2d_2.log",'r') f=open("/Users/jeff/Research/Simcore/rigid_diffusion_l...
github_jupyter
# 1 Introducing neural networks You have already been introduced to neural networks in the study materials: now you are going to have an opportunity to play with them in practice. Neural networks can solve subtle pattern-recognition problems, which are very important in robotics. Although many of the activities are p...
github_jupyter
# Diseño de software para cómputo científico ---- ## Unidad 3: Persistencia de datos. ### Agenda de la Unidad 3 --- #### Clase 1 - Lectura y escritura de archivos. - Persistencia de binarios en Python (`pickle`). - Archivos INI/CFG, CSV, JSON, XML y YAML ## Lectura y escritura de archivos - Python ofrece los obj...
github_jupyter
# A Simple Staggered FV Code for the Navier-Stokes Equations ### Tony Saad <br/> Assistant Professor of Chemical Engineering <br/> University of Utah ``` import numpy as np %matplotlib inline %config InlineBackend.figure_format = 'svg' import matplotlib.pyplot as plt import matplotlib.animation as animation from matpl...
github_jupyter