text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Chapter 4 ## Question 11 Using the `Auto` data set to predict whether a given car has high or low mileage (seems like a regression on `mpg` to me?) ``` import statsmodels.api as sm import numpy as np import seaborn as sns import sklearn.model_selection import sklearn.discriminant_analysis import sklearn.neighbors ...
github_jupyter
# Time series forecasting with DeepAR - Synthetic data DeepAR is a supervised learning algorithm for forecasting scalar time series. This notebook demonstrates how to prepare a dataset of time series for training DeepAR and how to use the trained model for inference. ``` import time import numpy as np np.random.seed(...
github_jupyter
``` import cv2 import numpy as np import matplotlib.pyplot as plt import glob import pathlib %matplotlib inline class ColorReduction: def __call__(self, img): if len(img.shape) == 3: return self.apply_3(img) if len(img.shape) == 2: return self.apply_2(img) return None...
github_jupyter
``` import pandas as pd import csv import re # names of files to read from r_maxo_classes_with_definitionsTSV = '~/Git/MAxO/src/ontology/sparql-test/maxo_classes_with_definitions.tsv' r_ncit_definitionsTSV = '~/Git/MAxO/src/ontology/sparql-test/ncit_definitions.tsv' tsv_read_maxo = pd.read_csv(r_maxo_classes_with_defi...
github_jupyter
# RNA velocity analysis using scVelo * __Notebook version__: `v0.0.1` * __Created by:__ `Imperial BRC Genomics Facility` * __Maintained by:__ `Imperial BRC Genomics Facility` * __Docker image:__ `imperialgenomicsfacility/scanpy-notebook-image:release-v0.0.4` * __Github repository:__ [imperial-genomics-facility/scanpy-...
github_jupyter
# Querying WikiData for henet edges ``` import json import pandas as pd from pathlib import Path from datetime import datetime from tqdm import tqdm_notebook # ModuleNotFoundError ## edited "hetnet_ml.src" to "hetnet_ml" in .py script import wdhetnetbuilder as wdh # make sure wikidataintegrator is installed ## pip in...
github_jupyter
``` import pandas as pd import seaborn as sns import sys from matplotlib import pyplot as plt %matplotlib inline MIN_PYTHON = (3, 6) if sys.version_info < MIN_PYTHON: sys.exit("Python %s.%s or later is required.\n" % MIN_PYTHON) in_data = pd.read_csv('afterfix_speed_test.log.csv', index_col='TS...
github_jupyter
# Tema 03: Control de flujo (Enunciados) *Nota: Estos ejercicios son optativos para hacer al final de la unidad y están pensados para apoyar tu aprendizaje*. **1) Realiza un programa que lea dos números por teclado y permita elegir entre 3 opciones en un menú:** * Mostrar una suma de los dos números * Mostrar una res...
github_jupyter
# `yacman` features and usage This short tutorial show you the features of `yacman` package in action. First, let's prepare some data to work with ``` import yaml yaml_dict = {'cfg_version': 0.1, 'lvl1': {'lvl2': {'lvl3': {'entry': ['val1', 'val2']}}}} yaml_str = """\ cfg_version: 0.1 lvl1: lvl2: lvl3: e...
github_jupyter
## SIS on Beer Reviews - Model Training Aspect 1 (Aroma) ``` import numpy as np from matplotlib import pyplot as plt import seaborn as sns import os import sys import gzip sys.path.insert(0, os.path.abspath('..')) from keras.callbacks import ModelCheckpoint from keras.models import load_model, Model, Sequential from ...
github_jupyter
``` """ Update Parameters Here """ CONTRACT_ADDRESS = "0x9A534628B4062E123cE7Ee2222ec20B86e16Ca8F" COLLECTION = "MekaVerse" METHOD = "raritytools" TOKEN_COL = "TOKEN_ID" # Use TOKEN_NAME if you prefer to infer token id from token name NUMBERS_TO_CHECK = 50 # Number of tokens to search for opportunities import time im...
github_jupyter
``` import tensorflow as tf import os os.environ['CUDA_VISIBLE_DEVICES'] = '' import tensorflow as tf import numpy as np # !wget https://raw.githubusercontent.com/tensorflow/models/master/research/slim/nets/inception_utils.py import tensorflow.compat.v1 as tf import tf_slim as slim import inception_utils def bloc...
github_jupyter
![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg) Find this notebook in https://colab.research.google.com/github/ricardokleinklein/NLP_GenMods/blob/main/Tacotron2.ipynb # Modelos Generativos ## Tacotron2 - Audio Creado por *Ricardo Kleinlein* para [Saturdays.AI](https://saturdays.ai/). Dis...
github_jupyter
``` ####This notebook required run on parallel algorithms which base on MPI#### import numpy as np import libpysal as ps from stwr.gwr import GWR, MGWR,STWR from stwr.sel_bw import * from stwr.utils import shift_colormap, truncate_colormap import geopandas as gp import matplotlib.pyplot as plt import matplotlib as ...
github_jupyter
``` import tensorflow as tf print(tf.__version__) !ls ../chapter_07/train_base_model/tf_datasets/ !ls -lrt /content/tfrecord-dataset/flowers import tensorflow as tf import tensorflow_hub as hub import tensorflow_datasets as tfds import os import matplotlib.pyplot as plt from PIL import Image, ImageOps import IPython.di...
github_jupyter
``` from __future__ import division import numpy as np from pyspark import SparkConf from pyspark import SparkContext conf = SparkConf() conf.setMaster('spark://ip-172-31-9-200:7077') conf.setAppName('spark_analytics_chpt_4') conf.set("spark.executor.memory", "10g") sc = SparkContext(conf=conf) ``` Data from https://...
github_jupyter
# Brain connectome comparison using geodesic distances **Authors:** S. Shailja and B.S. Manjunath **Affiliation:** University of California, Santa Barbara The goal of this notebook is to study the importance of geodesic distances on manifolds. Towards that end, we propose the following twin study. We utilize the st...
github_jupyter
``` import torch import torch.nn as nn import numpy as np import matplotlib.pyplot as plt import sklearn.datasets as skl import torch.linalg as lin ``` ## LQR with deterministic dynamics ![image-5.png](attachment:image-5.png) 위에 기술된 최적화 문제는 환경 $f(\textbf{x}_t, \textbf{u}_t)$ 가 선형(Linear)이고, Cost function이 Quadratic...
github_jupyter
# BERT NER [Model files available here. They are quite large](https://drive.google.com/open?id=11CPrF1rlZ-5eCv0m-UlFiAbCy3Z-yG54) ### Setting up workspace ``` import os import pathlib # ********************************************************* # If you actually want to train, switch to GPU runtime now. # ***********...
github_jupyter
``` import os import warnings from datetime import datetime, timedelta from typing import Tuple import matplotlib.pyplot as plt import pandas as pd from dotenv import load_dotenv from prometheus_api_client import MetricSnapshotDataFrame, MetricRangeDataFrame, PrometheusConnect from prometheus_api_client.utils import p...
github_jupyter
##### Exercise 5.1 Consider the diagrams on the right in Figure 5.2. Why does the value function jump up for the last two rows in the rear? Why does it drop off for the whole last row on the left? Why are the frontmost values higher in the upper diagrams than in the lower? Jumps up for last two rows in the rear sinc...
github_jupyter
``` %load_ext autoreload import numpy as np import os import matplotlib.pyplot as plt import pickle from enterprise import constants as const from enterprise.signals import parameter from enterprise.signals import selections from enterprise.signals import signal_base from enterprise.signals import white_signals from e...
github_jupyter
<a href="https://colab.research.google.com/github/unicamp-dl/IA025_2022S1/blob/main/ex02/Fernanda_Caldas/FernandaCaldas_Semana2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Notebook de referência Nome: Fernanda Caldas ## Instruções Este exe...
github_jupyter
# Subscriber with JSON export __NOTE__: this is an __outdated__ notebook, some of the functions that are used here are considered __private__ to QCoDeS and are not intended for use by users (for example, `DataSet.subscribe`). This notebook will be re-written in the future. ``` import logging import copy import numpy ...
github_jupyter
##### Copyright 2020 The Cirq Developers ``` #@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 agre...
github_jupyter
# Analysis Report We report the following SageMaker analysis. ## Pre-training Bias Metrics We computed the bias metrics for the label `sentiment` using label value(s)/threshold `1`. * **product_category** The groups are represented in the dataset with the following proportions. <img src='data:image/p...
github_jupyter
## Campaign 2, Day 1 *** #### STEP 1 (day1_step1_TransferCells.hso) * Transfer 180uL cells from 12 channel reservoir - column 1 to BlackwClearBottomAssay - columns 1-6 * Transfer 180uL cells from 12 channel reservoir - column 1 to BlackwClearBottomAssay - columns 7-12 #### STEP 2 (day1_step2_DiluteMuconate...
github_jupyter
``` import json import re import sentencepiece as spm import os os.environ['CUDA_VISIBLE_DEVICES'] = '1' from prepro_utils import preprocess_text, encode_ids, encode_pieces sp_model = spm.SentencePieceProcessor() sp_model.Load('sp10m.cased.bert.model') with open('sp10m.cased.bert.vocab') as fopen: v = fopen.read(...
github_jupyter
# Visually Shaping Distributions with TrafPy This Notebook shows an example of how to shape distributions with `TrafPy`. We will save our shaped distributions, re-load them, and use them to generate custom flow-centric traffic data, which we will then save in .pickle format such that you'd be able to import the traffi...
github_jupyter
``` import os from concurrent.futures import ProcessPoolExecutor from pathlib import Path import matplotlib.pyplot as plt from lhotse import CutSet, Fbank, LilcomFilesWriter from lhotse.augmentation import SoxEffectTransform, RandomValue from lhotse.dataset import K2SpeechRecognitionDataset from lhotse.dataset.sampli...
github_jupyter
reference: [Google Colab Python API](https://worldbank.github.io/OpenNightLights/tutorials/mod2_5_GEE_PythonAPI_and_geemap.html#google-colab-python-api) ``` import geemap, ee ``` `True` if run in Colab; `False` if local ``` 'google.colab' in str(get_ipython()) try: ee.Initialize() except Exception as e: ...
github_jupyter
### Working with Avro files Here are some examples of working with ZTF alerts stored as avro files. ``` import os import io import gzip import numpy as np import pandas as pd import matplotlib.pyplot as plt from avro.datafile import DataFileReader, DataFileWriter from avro.io import DatumReader, DatumWriter import f...
github_jupyter
``` %matplotlib inline import numpy as np import pylab as plt import cv2 data_root = '/diskmnt/a/makov/yaivan/2016-02-11_Pin/' ``` Список файлов: * empty - файл полученный с томографа без коррекций * corr - то же изображение что и empty, но с коррекцией * tomo - то же, что и empty, но полученное в ходе проведения эксп...
github_jupyter
``` %load_ext autoreload %autoreload 2 import ray import ray.rllib.agents.ppo as ppo from ray.tune.logger import pretty_print from ray import tune from ray.rllib.agents.ppo import PPOTrainer from ray.rllib.models import FullyConnectedNetwork, Model, ModelCatalog import os os.environ['TF_CPP_MIN_LOG_LEVEL'] =...
github_jupyter
``` # !pip install kfp # !pip install google-cloud-aiplatform # !pip install google-cloud-pipeline-components import kfp from kfp.v2 import compiler from kfp.v2.google.client import AIPlatformClient from google.cloud import aiplatform # from google.cloud.aiplatform import pipeline_jobs from google_cloud_pipeline_compon...
github_jupyter
# 1.Loading libraries and Dataset ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns import warnings warnings.filterwarnings('ignore') from sklearn.model_selection import KFold from sklearn.model_selection import train_test_split from sklearn.model_sel...
github_jupyter
<img align="center" style="max-width: 1000px" src="banner.png"> <img align="right" style="max-width: 200px; height: auto" src="hsg_logo.png"> ## Lab 03 - "Supervised Machine Learning" Assignments GSERM'21 course "Deep Learning: Fundamentals and Applications", University of St. Gallen The lab environment of the "De...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-use-adla-as-compute-target.png) # AML P...
github_jupyter
## WaMDaM Directions and Use Cases #### By Adel M. Abdallah, Utah State University, August 2018 The Water Management Data Model (WaMDaM) is a database design with companion software that uses contextual metadata and controlled vocabularies to organize water management data from multiple sources and models. The des...
github_jupyter
``` import cv2 import numpy as np import matplotlib.pyplot as plt %matplotlib inline class Interpolation: def bilinear(self, img, scale=1.5): H, W = img.shape[:2] H_big, W_big = int(H * scale), int(W * scale) if len(img.shape) == 2: ch = 1 output_img = np.zeros((H_big...
github_jupyter
# Stablecoin Billionaires<br> Descriptive Analysis of the Ethereum-based Stablecoin ecosystem ## by Anton Wahrstätter, 01.07.2020 # Part II - USDC ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from datetime import datetime from collections import Counter from matplotlib import rc import ...
github_jupyter
# Data collection In this notebook, I'll use the **GitHub API** to extract various information from my user profile such as repositories, commits and more. I'll also save this data to **.csv** files so that I can draw insights. ## Import libraries and defining constants I'll import various libraries needed for fetch...
github_jupyter
# Bigram https://towardsdatascience.com/text-analysis-basics-in-python-443282942ec5 # Loading data ``` import pandas as pd import numpy as np #agar mudah, letakkan file data dalam satu folder dengan file jupiter notebook nya filedata = 'discussion' dataSB = pd.read_excel(filedata+".xlsx", sheet_name="Sheet1") da...
github_jupyter
# Chapter 8: Planning and Learning with Tabular Methods ## 1. Models and Planning - **model-based** methods: - require a model of enviroment (DP, HS) - rely on **planning** - **model-free** methods: - does not require a model of enviroment (MC, TD) - rely on **learning** - heart of 2 methods is the com...
github_jupyter
**This notebook is an exercise in the [Intermediate Machine Learning](https://www.kaggle.com/learn/intermediate-machine-learning) course. You can reference the tutorial at [this link](https://www.kaggle.com/alexisbcook/data-leakage).** --- Most people find target leakage very tricky until they've thought about it fo...
github_jupyter
# Bagging Double Deep Q Learning - A simple ambulance dispatch point allocation model ## Reinforcement learning introduction ### RL involves: * Trial and error search * Receiving and maximising reward (often delayed) * Linking state -> action -> reward * Must be able to sense something of their environment * Involves...
github_jupyter
![title](vw.png) https://github.com/VowpalWabbit/vowpal_wabbit webspam: https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary.html Реализация стохастического градиентного спуска для линейхных моделей, позволяющая запускаться на больших объёмах данных, за счет последовательной загрузки и обработки примеров. ...
github_jupyter
``` from keras.models import Sequential from keras.layers import Dense from keras.wrappers.scikit_learn import KerasRegressor from sklearn.model_selection import cross_val_score from sklearn.model_selection import KFold from sklearn.preprocessing import StandardScaler from sklearn.pipeline import Pipeline from keras.op...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/automated-machine-learning/sparse-data-train-test-split/auto-ml-sparse-data-train-test-split.png) # ...
github_jupyter
``` # # This MaterialsAutomated example shows how to overlay simulated Laue spots on # experimental data in an automated fashion. # # It utilizes an existing open-source Laue diffraction analysis toolkit, LaueTools: # https://gitlab.esrf.fr/micha/lauetools # # If the goal is to analyze a single or small number of d...
github_jupyter
# Python Comments Comments are lines that exist in computer programs that are ignored by compilers and interpreters. Including comments in programs makes code more readable for humans as it provides some information or explanation about what each part of a program is doing. In general, it is a good idea to write co...
github_jupyter
``` import pickle from misc import * import SYCLOP_env as syc from RL_brain_b import DeepQNetwork import matplotlib.pyplot as plt %matplotlib notebook import cv2 from scipy import misc import glob datapath='/home/bnapp/arivkindNet/video_datasets/dataset-corridor1_512_16/mav0/cam0/data/' images=[] max_image = 2 image_cn...
github_jupyter
# 基于注意力的神经机器翻译 此笔记本训练一个将缅甸语翻译为英语的序列到序列(sequence to sequence,简写为 seq2seq)模型。此例子难度较高,需要对序列到序列模型的知识有一定了解。 训练完此笔记本中的模型后,你将能够输入一个缅甸语句子,例如 *"ဘာကိစ္စ မဖြစ်ရ မှာ လဲ?"*,并返回其英语翻译 *"Why not?"* 对于一个简单的例子来说,翻译质量令人满意。但是更有趣的可能是生成的注意力图:它显示在翻译过程中,输入句子的哪些部分受到了模型的注意。 <img src="https://tensorflow.google.cn/images/spanish-english.png" ...
github_jupyter
``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed u...
github_jupyter
``` import _init_paths import argparse import os import sys import logging import pprint import cv2 from config.config import config, update_config from utils.image import resize, transform import numpy as np # get config os.environ['PYTHONUNBUFFERED'] = '1' os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0' os.environ[...
github_jupyter
# Python review of concepts Mainly to point out useful aspects of Python you may have glossed over. Assumes you already know Python fairly well. ## Python as a language ### Why Python? - Huge community - especially in data science and ML - Easy to learn - Batteries included - Extensive 3rd party libraries - Wi...
github_jupyter
# MAT281 ## Aplicaciones de la Matemática en la Ingeniería ## ¿Qué contenido aprenderemos? * Manipulación de datos con ```pandas```. - Crear objetos (Series, DataFrames, Index). - Análisis exploratorio. - Realizar operaciones y filtros. - Aplicar funciones y métodos. ## Motivación En los últimos año...
github_jupyter
# Open and run analysis on multiple polygons <img align="right" src="../Supplementary_data/dea_logo.jpg"> * [**Sign up to the DEA Sandbox**](https://docs.dea.ga.gov.au/setup/sandbox.html) to run this notebook interactively from a browser * **Compatibility:** Notebook currently compatible with both the `NCI` and `DEA S...
github_jupyter
# Aula 01 - Introdução à Ciência de Dados ## Indústria 4.0 / Sociedade 5.0 <!-- Figura --> <center> <img src='../figs/01/society-5-industry-4.png' width=900px> </img> </center> [Fonte](https://www.sphinx-it.eu/from-the-agenda-of-the-world-economic-forum-2019-society-5-0/) ## Ciência de Dados no Século XXI - D...
github_jupyter
# CPT example: planning dual-Doppler campaign ### Nikola Vasiljevic, August 24th 2019 In this example we will use [CPT](https://www.wind-energ-sci-discuss.net/wes-2019-13/) to plan a fictive measurement campaign for a site consisting of 12x80m turbines. <br>The site is located at the sea coast of Croatia in vicinity o...
github_jupyter
# Unlocking the Black Box: How to Visualize Data Science Project Pipeline with Yellowbrick Library No matter whether you are a novice data scientist or a well-seasoned and established professional working in the field for a long time, you most likely faced a challenge of interpreting results generated at any stage of ...
github_jupyter
### Utilitary Functions Definition of functions that don't belong to a specific class inside the logic of the problem solution ``` import numpy as np import numpy as np import matplotlib.pyplot as plt import seaborn as sns import math import copy %matplotlib inline def pseudo_transpose(listt): ''' Utilitary ...
github_jupyter
# Ray RLlib - Extra Application Example - FrozenLake-v0 © 2019-2021, Anyscale. All Rights Reserved ![Anyscale Academy](../../../images/AnyscaleAcademyLogo.png) This example uses [RLlib](https://ray.readthedocs.io/en/latest/rllib.html) to train a policy with the `FrozenLake-v0` environment ([gym.openai.com/envs/Froze...
github_jupyter
# Artificial Intelligence in Finance ## Data-Driven Finance (a) ## Financial Econometrics and Regression ``` import numpy as np def f(x): return 2 + 1 / 2 * x x = np.arange(-4, 5) x y = f(x) y x y beta = np.cov(x, y, ddof=0)[0, 1] / x.var() beta alpha = y.mean() - beta * x.mean() alpha y_ = alpha + beta * x np.a...
github_jupyter
``` # Configuracion para recargar módulos y librerías %reload_ext autoreload %autoreload 2 ``` # MAT281 ## Aplicaciones de la Matemática en la Ingeniería Puedes ejecutar este jupyter notebook de manera interactiva: [![Binder](../shared/images/jupyter_binder.png)](https://mybinder.org/v2/gh/sebastiandres/mat281_m01...
github_jupyter
# The Hill-Tononi Neuron and Synapse Models ## Hans Ekkehard Plesser, NMBU/FZ Jülich/U Oslo, 2016-12-01 ## Background This notebook describes the neuron and synapse model proposed by Hill and Tononi in *J Neurophysiol* 93:1671-1698, 2005 ([doi:10.1152/jn.00915.2004](http://dx.doi.org/doi:10.1152/jn.00915.2004)) and ...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import numpy as np from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem import Descriptors from sklearn.model_selection import train_test_split from sklearn.neural_network import MLPClassifier from sklearn.preprocessing import StandardScaler from ...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import scipy from sklearn.model_selection import ParameterGrid from sklearn.manifold import Isomap import time from tqdm import tqdm import librosa from librosa import cqt from librosa.core import amplitude_to_db from librosa.display import specshow import os im...
github_jupyter
``` import pandas as pd import seaborn as sns import numpy as np import matplotlib.pyplot as plt from datetime import datetime, timedelta from sklearn.cluster import KMeans from sklearn.ensemble import RandomForestClassifier import shap ``` # Loading clean data ``` import os clean_files = ['cleaned_data/all_dataset/...
github_jupyter
Autor: Érick Barbosa de Souza Home: https://abre.ai/ebsouza-pagina Instagram: @erickbsouza --- **Programação Orientada a Objetos** Após aprender lógica de programação utilizando **programação estruturada**, é necessário aprender novos conceitos para resolver problemas comuns em computação. A **programação orient...
github_jupyter
<center> <img src="https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-PY0101EN-SkillsNetwork/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # Watson Speech to Text Translator Estimated time needed: **25** minutes ## Objectives After completing this...
github_jupyter
``` name = '2017-06-02-matplotlib-contourf-subplots' title = 'Filled contour plots and colormap normalization' tags = 'matplotlib' author = 'Maria Zamyatina' from nb_tools import connect_notebook_to_post from IPython.core.display import HTML, Image html = connect_notebook_to_post(name, title, tags, author) ``` Today ...
github_jupyter
# Symbulate Documentation # Random Processes <a id='contents'></a> 1. [**RandomProcess and TimeIndex**](#time) 1. [**Defining a RandomProcess explicitly as a function of time**](#Xt) 1. [**Process values at particular time points**](#value) 1. [**Mean function**](#mean) 1. [**Defining a RandomProcess increm...
github_jupyter
# Mosaic ``` %matplotlib inline import matplotlib.pyplot as plt from matplotlib import rc import matplotlib.font_manager rc('font',**{'family':'serif','serif':['Computer Modern Roman'],'size':13}) rc('text', usetex=True) import pandas as pd import numpy as np from statistics import load def plot(ax, frame, cell_type...
github_jupyter
# Autoencoders ## Imports ``` import matplotlib.pyplot as plt import numpy as np import pandas as pd import tensorflow as tf from sklearn.metrics import accuracy_score, precision_score, recall_score from sklearn.model_selection import train_test_split from tensorflow.keras import layers, losses from tensorflow.keras...
github_jupyter
# Homework and bake-off: Sentiment analysis ``` __author__ = "Christopher Potts" __version__ = "CS224u, Stanford, Spring 2021" ``` ## Contents 1. [Overview](#Overview) 1. [Methodological note](#Methodological-note) 1. [Set-up](#Set-up) 1. [Train set](#Train-set) 1. [Dev sets](#Dev-sets) 1. [A softmax baseline](#A-so...
github_jupyter
# Semantic Vector Space Construct a basic semantic vector set for disambiguating coordinate relations. ``` import collections from datetime import datetime from tools.langtools import PositionsTF from tools.significance import apply_fishers, contingency_table from tools.locations import data_locations from cxbuilders...
github_jupyter
# TensorFlow实现VGG16 ## 导入需要使用的库 ``` import inspect import os import numpy as np import tensorflow as tf ``` ## 定义卷积层 ``` '''Convolution op wrapper, use RELU activation after convolution Args: layer_name: e.g. conv1, pool1... x: input tensor, [batch_size, height, width, channels] out_cha...
github_jupyter
``` # conda/pip install pycircstat import sys import os import math import random import pickle import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from scipy import stats,io import pycircstat from scipy.ndimage import gaussian_filter1d ``` # Functions ``` sys.path.append('...
github_jupyter
``` # default_exp convert ``` # The Converter > The internals for the lib2nbdev functionality ``` #hide from nbdev.showdoc import * #hide from fastcore.test import * #export import json from fastcore.basics import Path from fastcore.xtras import is_listy from fastcore.foundation import Config from fastcore.script i...
github_jupyter
# Working with Landsat Thematic Mapper Imagery ![](http://esri.github.io/arcgis-python-api/notebooks/nbimages/02_change_detection_app_01.gif) # Questions - How does land change manifest itself in time-series of multispectral imagery? - Can you identify when a significant disturbance occurred? # Let's explore Landsat...
github_jupyter
# Tutorial 3.1. Structural response under windload ### Description: For the given geometry, compute the shear force and the bending moment of the structure along the height for the given wind load. Compare the base shear and the bending moment at the base with other buildings of similar height Project: Structural Wi...
github_jupyter
# Road Following - Data Collection (using Gamepad) If you've run through the collision avoidance sample, your should be familiar following three steps 1. Data collection 2. Training 3. Deployment In this notebook, we'll do the same exact thing! Except, instead of classification, you'll learn a different fundamen...
github_jupyter
## Rock, Paper & Scissors with TensorFlow Hub - TFLite <table class="tfo-notebook-buttons" align="left"> <td> <a target="_blank" href="https://colab.research.google.com/github/mohan-mj/tflite-rock_paper_scissors/blob/main/tflite_rock_paper_scissors.ipynb"> <img src="https://www.tensorflow.org/images/colab_lo...
github_jupyter
## Preamble ``` import json import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cm as cmx plt.style.use('ggplot') import qsharp qsharp.packages.add("Microsoft.Quantum.MachineLearning::0.14.2011120240") qsharp.reload() from Microsoft.Quantum.Samples import ( Tr...
github_jupyter
# Z-score (Solution) ## Install packages ``` import sys !{sys.executable} -m pip install -r requirements.txt import cvxpy as cvx import numpy as np import pandas as pd import time import os import quiz_helper import matplotlib.pyplot as plt %matplotlib inline plt.style.use('ggplot') plt.rcParams['figure.figsize'] = (...
github_jupyter
<a href="https://colab.research.google.com/github/suredream/CNN-Sentinel/blob/master/mnist.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Version Control ``` %%bash function auth(){ echo $(grep $1 ~/.auth_git | cut -d'"' -f 4 ) } user=$(auth...
github_jupyter
# diverse development using pennlinckit ``` import sys factor = sys.argv[1] ``` #### pennlinckit contains data, plotting, brain, network science, and math functions common to neuroscience projects ``` import pennlinckit ``` #### standard libraries ``` import numpy as np import scipy.stats import seaborn as sns imp...
github_jupyter
``` import pandas as pd import numpy as np import tensorflow as tf from keras.models import Sequential from keras.layers import Dense, Embedding, LSTM, SpatialDropout1D, Bidirectional from sklearn.model_selection import train_test_split from keras.utils.np_utils import to_categorical from keras.callbacks import EarlySt...
github_jupyter
# How to use ID Resolver Feature in BTE ## Important relevant modules ``` from biothings_explorer.resolve_ids import syncQuery as query import nest_asyncio nest_asyncio.apply() ``` ## Generate some sample inputs and convert to curie format ``` ncbigenes = ["85456", "85461", "85462", "8578", "8622", "8630", "8669", ...
github_jupyter
# Time Series Filters ``` %matplotlib inline from __future__ import print_function import pandas as pd import matplotlib.pyplot as plt import statsmodels.api as sm dta = sm.datasets.macrodata.load_pandas().data index = pd.Index(sm.tsa.datetools.dates_from_range('1959Q1', '2009Q3')) print(index) dta.index = index del...
github_jupyter
# NumPy Data Access Using ArcPy ``` import arcpy as ARCPY import arcpy.da as DA inputFC = r'../data/CA_Polygons.shp' fieldNames = ['PCR2000', 'POP2000', 'PERCNOHS'] tab = DA.TableToNumPyArray(inputFC, fieldNames) print(tab) ``` # SSDataObject 1. Environment Settings (Except Extent) 2. Bad Records 3. Error/Warning Mes...
github_jupyter
# Examples of all decoders (except Kalman Filter) In this example notebook, we: 1. Import the necessary packages 2. Load a data file (spike trains and outputs we are predicting) 3. Preprocess the data for use in all decoders 4. Run all decoders and print the goodness of fit 5. Plot example decoded outputs See "Exampl...
github_jupyter
``` results = {'nist_mdipfl50_mymodel-hardest_trainacc': [100.0, 97.1, 93.9, 89.9, 87.8, 85.7, 85.0, 83.2, 82.1, 81.0], 'nist_mdipfl50_mymodel-hardest_valacc': [100.0, 96.2, 93.2, 88.3, 87.1, 82.9, 79.9, 81.1, 79.5, 75.1], 'nist_mdipfl50_mymodel_trainacc': [100.0, 95.1, 89.1, 87.6, 84.9, 83.3, 80.0, 76.7, 75.9, 71.2], ...
github_jupyter
# Slider bar decline curve in python Created by Thomas Martin, PhD canidate at [CoRE](https://core.mines.edu/) at Colorado School of Mines. Personal website is [here](https://tmartin.carrd.co/), and email is thomasmartin@mines.edu. ``` import matplotlib.pyplot as plt import pandas as pd import numpy as np import pyla...
github_jupyter
Tutorial: VIC 5 Image Driver Parameter Conversion ==== ***Converting parameters from ASCII VIC 4 format to netCDF VIC 5 Image Driver Format*** This Jupyter Notebook outlines one approach to converting VIC parameters from ASCII to netCDF format. For this tutorial, we'll convert three datasets from ASCII to netCDF: 1. ...
github_jupyter
### Predict lung masks and Covid vs non-Covid classification for new patient CXR using Module 1 trained on the V7 lung segmentation database, and Module 2 trained on the HFHS dataset ``` # In[1]: import os, sys, shutil from os import listdir from os.path import isfile, join import random import numpy as np import cv2...
github_jupyter
``` #import libraries import networkx as nx import numpy as np import matplotlib.pyplot as plt import scipy.stats import collections ``` source: http://snap.stanford.edu/data/twitch-social-networks.html 3 réseaux de Twitch de pays différents. ``` #Read datasets # #GB infile='data/musae_ENGB_edges.csv' GB=nx.read_edg...
github_jupyter
``` import json import os import geopandas as gpd import matplotlib.pyplot as plt import pandas as pd import osmnx as ox import random import numpy as np %matplotlib inline cities = ['adelaide', 'auckland', 'baltimore', 'bangkok', 'barcelona', 'belfast', 'bern', 'chennai', 'mexico_city', 'cologne', 'ghent', 'graz', 'h...
github_jupyter
# Algoritmos de Ordenação ``` from IPython.display import Image Image("complexity.png") ``` ## 1. Selection Sort ``` # Implementação class SelectionSort(object): def sort(self, data): for i in range(0, len(data)-1): min_index = self.min_index(i + 1, data) ...
github_jupyter