code
stringlengths
2.5k
150k
kind
stringclasses
1 value
``` # default_exp callback.noisy_student ``` # Noisy student > Callback to apply noisy student self-training (a semi-supervised learning approach) based on: Xie, Q., Luong, M. T., Hovy, E., & Le, Q. V. (2020). Self-training with noisy student improves imagenet classification. In Proceedings of the IEEE/CVF Conference...
github_jupyter
# Customer Churn Prediction ``` # Importing necessary libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set_style('darkgrid') #import warnings #warnings.simplefilter("ignore") ``` ### Data Preparation based on EDA ``` def datapreparation(filepath): d...
github_jupyter
# 窗口函数与卷积 ``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline ``` ## 窗口函数 在信号处理中,窗函数(window function)是一种除在给定区间之外取值均为0的实函数.譬如:在给定区间内为常数而在区间外为0的窗函数被形象地称为矩形窗.任何函数与窗函数之积仍为窗函数,所以相乘的结果就像透过窗口"看"其他函数一样.窗函数在频谱分析,滤波器设计,波束形成,以及音频数据压缩(如在Ogg Vorbis音频格式中)等方面有广泛的应用. numpy中提供了几种常见的窗函数 函数|说明 ---|--- bartlett(...
github_jupyter
# Basics of the DVR calculations with Libra ## Table of Content <a name="TOC"></a> 1. [General setups](#setups) 2. [Mapping points on multidimensional grids ](#mapping) 3. [Functions of the Wfcgrid2 class](#wfcgrid2) 4. [Showcase: computing energies of the HO eigenstates](#ho_showcase) 5. [Dynamics: computed with SOF...
github_jupyter
> **提示**:欢迎参加“调查数据集”项目!引用段会添加这种提示,帮助你制定调查方法。提交项目之前,最后浏览一下报告,将这一段删除,以保持报告简洁。首先,需要双击这个 Markdown 框,将标题更改为与数据集和调查相关的标题。 # 项目:TMDB电影集调查 ## 目录 <ul> <li><a href="#intro">简介</a></li> <li><a href="#wrangling">数据整理</a></li> <li><a href="#eda">探索性数据分析</a></li> <li><a href="#conclusions">结论</a></li> </ul> <a id='intro'></a> ## ...
github_jupyter
## Allele filp QC YML generator This module takes in a table of sumstat, with the columns: #chr, theme1, theme2, theme3 and each rows as 1 chr and the sumstat of corresponding chr and generate a list of yml to be used ``` [global] # List of path to the index of sumstat, each correspond to 1 recipe file documenting the...
github_jupyter
# Predicting the Outcome of Cricket Matches ## Introduction In this project, we shall build a model which predicts the outcome of cricket matches in the Indian Premier League using data about matches and deliveries. ### Data Mining: * Season : 2008 - 2015 (8 Seasons) * Teams : DD, KKR, MI, RCB, KXIP, RR, CSK (7...
github_jupyter
Let's load the data from the csv just as in `dataset.ipynb`. ``` import pandas as pd import numpy as np raw_data_file_name = "../dataset/fer2013.csv" raw_data = pd.read_csv(raw_data_file_name) ``` Now, we separate and clean the data a little bit. First, we create an array of only the training data. Then, we create a...
github_jupyter
# PTN Template This notebook serves as a template for single dataset PTN experiments It can be run on its own by setting STANDALONE to True (do a find for "STANDALONE" to see where) But it is intended to be executed as part of a *papermill.py script. See any of the experimentes with a papermill script to get sta...
github_jupyter
## 1 Simple time series Simple time series example: tracking state with linear dynamics ``` from pfilter import ParticleFilter, independent_sample, squared_error from scipy.stats import norm, gamma, uniform import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np %matplotlib inline ``` Utility fun...
github_jupyter
# Step 2 - Data Wrangling Raw Data in Local Data Lake to Digestable Data Loading, merging, cleansing, unifying and wrangling Oracle OpenWorld & CodeOne Session Data from still fairly raw JSON files in the local datalake. The gathering of raw data from the (semi-)public API for the Session Catalog into a local data ...
github_jupyter
``` pip install scipy==1.1.0 pip install pandas==0.21.3 #pip install numpy==1.18.1 from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.utils import np_utils from keras.preprocessing.text import Tokenizer from keras import metrics from keras.layers.embeddings import Em...
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 tensorflow,numpy `...
github_jupyter
# SQL TO KQL Conversion (Experimental) The `sql_to_kql` module is a simple converter to KQL based on [moz_sql_parser](https://github.com/DrDonk/moz-sql-parser). It is an experimental feature built to help us convert a few queries but we thought that it was useful enough to include in MSTICPy. You must have msticpy in...
github_jupyter
<a href="https://colab.research.google.com/github/oferbaharav/tally-ai-ds/blob/eda/Ofer_Spacy_NLP.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import boto3 import dask.dataframe as dd #from sagemaker import get_execution_role import pandas as...
github_jupyter
``` #hide #skip ! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab #all_slow #export from fastai.basics import * from fastai.learner import Callback #hide from nbdev.showdoc import * #default_exp callback.azureml ``` # AzureML Callback Track fastai experiments with the azure machine learning plat...
github_jupyter
``` # import libraries here; add more as necessary import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline df2019 = pd.read_csv('./2019survey_results_public.csv', header = 0) df2019.head() df2019.describe() def compare_plt(column, n, df): fig, axs = plt.subpl...
github_jupyter
``` #Importing necessary dependencies import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns pd.set_option('display.max_columns',None) df=pd.read_excel('Data_Train.xlsx') df.head() df.shape ``` ## Exploratory data analysis First we will try to find the missing values and we will ...
github_jupyter
``` %run ../../main.py %matplotlib inline import pandas as pd from cba.algorithms import M1Algorithm, M2Algorithm, top_rules, createCARs from cba.data_structures import TransactionDB import sklearn.metrics as skmetrics df = pd.read_csv("c:/code/python/machine_learning/assoc_rules/train/lymph0.csv") len(df) # # # ===...
github_jupyter
# Multiple Qubits & Entangled States Single qubits are interesting, but individually they offer no computational advantage. We will now look at how we represent multiple qubits, and how these qubits can interact with each other. We have seen how we can represent the state of a qubit using a 2D-vector, now we will see ...
github_jupyter
# A Transformer based Language Model from scratch > Building transformer with simple building blocks - toc: true - branch: master - badges: true - comments: true - author: Arto - categories: [fastai, pytorch] ``` #hide import sys if 'google.colab' in sys.modules: !pip install -Uqq fastai ``` In this notebook i'm...
github_jupyter
``` %%bash head /Users/jackyso/Desktop/data_files/source_data.json """ clean and prep data for matching: lowercase everything, take only first 5 digits of zip, pop out each address from each doctor, make all string to preserve zip and npi values columns = ['first_name','last_name','npi','street','street_2','zip','city...
github_jupyter
# Regularization Welcome to the second assignment of this week. Deep Learning models have so much flexibility and capacity that **overfitting can be a serious problem**, if the training dataset is not big enough. Sure it does well on the training set, but the learned network **doesn't generalize to new examples** that...
github_jupyter
## First test tables notebook: Create and destroy tables in Postgres using psycopg2 ### Using GALAH data to test because they have full fits headers ``` # imports import os from astropy.io import fits import sqlalchemy from sqlalchemy import create_engine, Table, Column, Integer, String, Float, MetaData, ForeignKey # ...
github_jupyter
## <span style="color:purple">ArcGIS API for Python: Real-time Person Detection</span> <img src="../img/webcam_detection.PNG" style="width: 100%"></img> ## Integrating ArcGIS with TensorFlow Deep Learning using the ArcGIS API for Python This notebook provides an example of integration between ArcGIS and deep learnin...
github_jupyter
<a href="https://colab.research.google.com/github/Meet953/TUS-Engineering-Team-Project/blob/main/ARIMA.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` def test_stationarity(timeseries): import matplotlib.pyplot as plt rolmean = timeseries.ro...
github_jupyter
# This is the Python Code for Chapter2 ''Statistical Learning" ## 2.3.1 Basic Commands ``` import numpy as np # for calculation purpose, let use np.array import random # for the random x = np.array([1, 3, 2, 5]) print(x) x = np.array([1, 6, 2]) print(x) y = [1, 4, 3] ``` ### use len() to find length of a vector ...
github_jupyter
``` from pathlib import Path import pandas as pd import numpy as np from import_clean_data import load_annotated_meter_data, load_co2_data from load_dayahead_prices import load_dayahead_prices import warnings import matplotlib.pyplot as plt DATA_DIR = (Path.cwd() / ".." / "Data").resolve() dayahead_2020_filename = "Day...
github_jupyter
``` import tensorflow as tf config = tf.compat.v1.ConfigProto( gpu_options = tf.compat.v1.GPUOptions(per_process_gpu_memory_fraction=0.8), ) config.gpu_options.allow_growth = True session = tf.compat.v1.Session(config=config) tf.compat.v1.keras.backend.set_session(session) import os import warnings warnings.filterw...
github_jupyter
# Notebook to be used to Develop Display of Results ``` from importlib import reload import pandas as pd import numpy as np from IPython.display import Markdown # If one of the modules changes and you need to reimport it, # execute this cell again. import heatpump.hp_model reload(heatpump.hp_model) import heatpump.hom...
github_jupyter
``` import pandas as pd medicare = pd.read_csv("/netapp2/home/se197/data/CMS/Data/medicare.csv") train_set = medicare[medicare.Hospital != 'BWH'] # MGH validation_set = medicare[medicare.Hospital == 'BWH'] # BWH and Neither import numpy as np fifty_perc_EHR_cont = np.percentile(medicare['Cal_MPEC_R0'],50) train_set_h...
github_jupyter
# Module 5 -- Dimensionality Reduction -- Case Study # Import Libraries **Import the usual libraries ** ``` import matplotlib.pyplot as plt import pandas as pd import numpy as np import seaborn as sns %matplotlib inline ``` # Data Set : Cancer Data Set Features are computed from a digitized image of a fine needle a...
github_jupyter
## CCNSS 2018 Module 5: Whole-Brain Dynamics and Cognition # Tutorial 2: Introduction to Complex Network Analysis (II) *Please execute the cell bellow in order to initialize the notebook environment* ``` !rm -rf data ccnss2018_students !if [ ! -d data ]; then git clone https://github.com/ccnss/ccnss2018_students; \ ...
github_jupyter
``` #import the needed package import requests import pandas as pd import numpy as np from bokeh.plotting import figure, output_file, show, output_notebook from bokeh.models import NumeralTickFormatter from bokeh.io import show from bokeh.layouts import column from bokeh.models import ColumnDataSource, CustomJS, Select...
github_jupyter
<a href="https://colab.research.google.com/github/dlmacedo/starter-academic/blob/master/3The_ultimate_guide_to_Encoder_Decoder_Models_3_4.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` %%capture !pip install -qq git+https://github.com/huggingfa...
github_jupyter
# BPR on ML-1m in Tensorflow ``` !pip install tensorflow==2.5.0 !wget -q --show-progress https://files.grouplens.org/datasets/movielens/ml-1m.zip !unzip ml-1m.zip import os import pandas as pd import numpy as np import random from time import time from tqdm.notebook import tqdm from collections import defaultdict imp...
github_jupyter
## 1: Import packages and Load data ``` import pandas as pd import os import matplotlib.pyplot as plt from google.colab import drive drive.mount('/content/drive') df = pd.read_csv('/content/drive/My Drive/Colab Notebooks/CoTAI/Data Science Internship CoTAI 2021/Sales Analysis/Data/sales2019_3.csv') df.head() df ``` #...
github_jupyter
# Step1: Create the Python Script In the cell below, you will need to complete the Python script and run the cell to generate the file using the magic `%%writefile` command. Your main task is to complete the following methods for the `PersonDetect` class: * `load_model` * `predict` * `draw_outputs` * `preprocess_outpu...
github_jupyter
``` import os import matplotlib.pyplot as plt from tqdm import tqdm import shutil import PIL import pandas as pd from libtiff import TIFF import numpy as np import re from tifffile import tifffile from sklearn.model_selection import StratifiedShuffleSplit, train_test_split from keras.preprocessing.image import ImageDa...
github_jupyter
# Think Bayes Second Edition Copyright 2020 Allen B. Downey License: [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/) ``` # If we're running on Colab, install empiricaldist # https://pypi.org/project/empiricaldist/ import sys IN_COLAB = ...
github_jupyter
``` !pip install --upgrade tables !pip install eli5 !pip install xgboost import pandas as pd import numpy as np from sklearn.dummy import DummyRegressor from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import RandomForestRegressor import xgboost as xgb from sklearn.metrics import mean_absolute_er...
github_jupyter
# Run a SageMaker Experiment with MNIST Handwritten Digits Classification This demo shows how you can use the [SageMaker Experiments Python SDK](https://sagemaker-experiments.readthedocs.io/en/latest/) to organize, track, compare, and evaluate your machine learning (ML) model training experiments. You can track artif...
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 from scipy.st...
github_jupyter
``` import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from torchvision import transforms, datasets apply_transform = transforms.Compose([ transforms.Resize(32) ,transforms.ToTensor() ]) BatchSize = 256 trainset = datasets.MNIST(root = './MNIST', train = True, download = True, trans...
github_jupyter
# Software Carpentry ### EPFL Library, November 2018 ## Program | | 4 afternoons | 4 workshops | | :-- | :----------- | :---------- | | > | `Today` | `Unix Shell` | | | Thursday 22 | Version Control with Git | | | Tuesday 27 | Python I | | | Thursday 29 | More Python | ## Why did you decide to attend this wo...
github_jupyter
## Dependencies ``` import json, glob from tweet_utility_scripts import * from tweet_utility_preprocess_roberta_scripts import * from transformers import TFRobertaModel, RobertaConfig from tokenizers import ByteLevelBPETokenizer from tensorflow.keras import layers from tensorflow.keras.models import Model ``` # Load ...
github_jupyter
# Machine Learning and Statistics for Physicists Material for a [UC Irvine](https://uci.edu/) course offered by the [Department of Physics and Astronomy](https://www.physics.uci.edu/). Content is maintained on [github](github.com/dkirkby/MachineLearningStatistics) and distributed under a [BSD3 license](https://openso...
github_jupyter
# Simple Go-To-Goal for Cerus The following code implements a simple go-to-goal behavior for Cerus. It uses a closed feedback loop to continuously asses Cerus' state (position and heading) in the world using data from two wheel encoders. It subsequently calculates the error between a given goal location and its curren...
github_jupyter
# Chatbot Tutorial - https://pytorch.org/tutorials/beginner/chatbot_tutorial.html ``` import torch from torch.jit import script, trace import torch.nn as nn from torch import optim import torch.nn.functional as F import csv import random import re import os import unicodedata import codecs from io import open import i...
github_jupyter
#### This project is a code along for the article I read here: https://www.analyticsvidhya.com/blog/2020/11/create-your-own-movie-movie-recommendation-system/ ``` # Importing required libraries and packages import pandas as pd import numpy as np from scipy.sparse import csr_matrix from sklearn.neighbors import Nearest...
github_jupyter
# Work with Data Data is the foundation on which machine learning models are built. Managing data centrally in the cloud, and making it accessible to teams of data scientists who are running experiments and training models on multiple workstations and compute targets is an important part of any professional data scien...
github_jupyter
``` import numpy as np import pandas as pd data=pd.read_csv("tech_sort1k.csv") data.head(15) data=data.drop(columns=["id","Note"]) #replacing null vals with empty list data['exact_matched_patt_contextual'] = [ [] if x is np.NaN else x for x in data['exact_matched_patt_contextual'] ] import nltk import re from bs4 impor...
github_jupyter
``` import speech_recognition as sr from transformers import Wav2Vec2Processor, HubertForCTC,Wav2Vec2ForCTC import soundfile as sf from datasets import load_dataset import torch pathSave = 'C:\\Users\\chushengtan\\Desktop\\' filename = 'audio_file_test.wav' timeout = 0.5 waiting_time = 10 r = sr.Recognizer() with sr.M...
github_jupyter
<a href="https://colab.research.google.com/github/Shrayansh19/Bike_Rentals_Forecast/blob/main/Bike_Rentals_Forecast_Model.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import numpy as np import pandas as pd from sklearn import preprocessing f...
github_jupyter
``` # -*- coding: utf-8 -*- """Example NumPy style docstrings. This module demonstrates documentation as specified by the `NumPy Documentation HOWTO`_. Docstrings may extend over multiple lines. Sections are created with a section header followed by an underline of equal length. Example ------- Examples can be given ...
github_jupyter
# odm2api demo with Little Bear SQLite sample DB Largely from https://github.com/ODM2/ODM2PythonAPI/blob/master/Examples/Sample.py - 4/25/2016. Started testing with the new `odm2` conda channel, based on the new `0.5.0-alpha` odm2api release. See my `odm2api_odm2channel` env. Ran into problems b/c the SQLite databas...
github_jupyter
# Part 5: Competing Journals Analysis In this notebook we are going to * Load the researchers impact metrics data previously extracted (see parts 1-2-3) * Get the full publications history for these researchers * Use this new publications dataset to determine which are the most frequent journals the researchers hav...
github_jupyter
# Optimizer Notebook ## Julia needs to compile once 🤷 ``` #Force Notebook to work on the parent Directory import os if ("Optimizer" in os.getcwd()): os.chdir("..") from julia.api import Julia jl = Julia(compiled_modules=False) from julia import Main Main.include("./Optimizer/eval_NN.jl") NN_path = "/home/freshs...
github_jupyter
This notebook is sample of the HAL QCD potential, the effective mass fitting, and the effective energy shifts of two-baryon system from compressed NBS wavefunction sample_data. In order to decompress the wave function, hal_pot_single_ch.py requires binary "PH1.compress48" in "yukawa library." ``` %pylab inline import...
github_jupyter
# CAMS functions ``` def get_ADS_API_key(): """ Get ADS API key to download CAMS datasets Returns: API_key (str): ADS API key """ keys_path = os.path.join('/', '/'.join( os.getcwd().split('/')[1:3]), 'adc-toolbox', os.path.relpath('data/ke...
github_jupyter
# SARK-110 Time Domain and Gating Example Example adapted from: https://scikit-rf.readthedocs.io/en/latest/examples/networktheory/Time%20Domain.html - Measurements with a 2.8m section of rg58 coax cable not terminated at the end This notebooks demonstrates how to use scikit-rf for time-domain analysis and gating. A...
github_jupyter
# Mouse Bone Marrow - merging annotated samples from MCA ``` import scanpy as sc import numpy as np import scipy as sp import pandas as pd import matplotlib.pyplot as plt from matplotlib import rcParams from matplotlib import colors import seaborn as sb import glob import rpy2.rinterface_lib.callbacks import logging ...
github_jupyter
``` # importing the required libraries import os import numpy as np import cv2 import matplotlib.pyplot as plt %matplotlib inline # function for reading the image # this image is taken from a video # and the video is taken from a thermal camera # converting image from BGR to RGB def read_image(image_path): image...
github_jupyter
## Histograms of Oriented Gradients (HOG) As we saw with the ORB algorithm, we can use keypoints in images to do keypoint-based matching to detect objects in images. These type of algorithms work great when you want to detect objects that have a lot of consistent internal features that are not affected by the backgrou...
github_jupyter
### Topic Modelling Demo Code #### Things I want to do - - Identify a package to build / train LDA model - Use visualization to explore Documents -> Topics Distribution -> Word distribution ``` !pip install pyLDAvis, gensim import numpy as np import pandas as pd # Visualization import matplotlib.pyplot as plt from m...
github_jupyter
### Introduction The `Lines` object provides the following features: 1. Ability to plot a single set or multiple sets of y-values as a function of a set or multiple sets of x-values 2. Ability to style the line object in different ways, by setting different attributes such as the `colors`, `line_style`, `stroke_width...
github_jupyter
# Clean-Label Feature Collision Attacks on a Keras Classifier In this notebook, we will learn how to use ART to run a clean-label feature collision poisoning attack on a neural network trained with Keras. We will be training our data on a subset of the CIFAR-10 dataset. The methods described are derived from [this pap...
github_jupyter
``` import tensorflow as tf import numpy as np from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) test_data = mnist.test train_data = mnist.train valid_data = mnist.validation epsilon = 1e-3 class FC(object): def __init__(self, learning_rate=0.0...
github_jupyter
# Strings Lesson goals: 1. Examine the string class in greater detail. 2. Use `open()` to open, read, and write to files. To start understanding the string type, let's use the built in helpsystem. ``` help(str) ``` The help page for string is very long, and it may be easier to keep it open in a browser window b...
github_jupyter
# Lecture 12: Canonical Economic Models [Download on GitHub](https://github.com/NumEconCopenhagen/lectures-2022) [<img src="https://mybinder.org/badge_logo.svg">](https://mybinder.org/v2/gh/NumEconCopenhagen/lectures-2022/master?urlpath=lab/tree/12/Canonical_economic_models.ipynb) 1. [OverLapping Generations (OLG) m...
github_jupyter
``` ##### Copyright 2020 Google LLC. #@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 ...
github_jupyter
# Group Metrics The `fairlearn` package contains algorithms which enable machine learning models to minimise disparity between groups. The `metrics` portion of the package provides the means required to verify that the mitigation algorithms are succeeding. ``` import numpy as np import pandas as pd import sklearn.met...
github_jupyter
<a href="https://colab.research.google.com/github/thomle295/CartPole_RL/blob/main/main.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` from google.colab import drive drive.mount('/content/gdrive', force_remount=True) %cd '/content/gdrive/My Driv...
github_jupyter
# The importance of space Agent based models are useful when the aggregate system behavior emerges out of local interactions amongst the agents. In the model of the evolution of cooperation, we created a set of agents and let all agents play against all other agents. Basically, we pretended as if all our agents were p...
github_jupyter
Code adapted from https://github.com/patrickcgray/open-geo-tutorial ``` from IPython.display import Audio, display from timeit import default_timer as timer start = timer() def color_stretch(image, index): colors = image[:, :, index].astype(np.float64) for b in range(colors.shape[2]): colors[:, :, b] =...
github_jupyter
## Getting Data ``` #import os #import requests #DATASET = ( # "https://archive.ics.uci.edu/ml/machine-learning-databases/abalone/abalone.data", # "https://archive.ics.uci.edu/ml/machine-learning-databases/abalone/abalone.names" #) #def download_data(path='data', urls=DATASET): # if not os.path.exists(pat...
github_jupyter
``` from __future__ import print_function import keras from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten from keras.layers import Conv2D, MaxPooling2D from keras import backend as K import matplotlib.pyplot as plt from keras.callbacks import TensorBoar...
github_jupyter
# Generic DKRZ national archive ingest form This form is intended to request data to be made locally available in the DKRZ nationl data archive besides the Data which is ingested as part of the CMIP6 replication. For replication requests a separate form is available. Please provide information on the following asp...
github_jupyter
# What is torch.nn ? ## MNIST data setup We will use the classic MNIST dataset, which consists of black-and-white images of hand-drawn digits (between 0 and 9). We will use pathlib for dealing with paths (part of the Python 3 standard library), and will download the dataset using requests. We will only import module...
github_jupyter
# Draw an isochrone map with OSMnx How far can you travel on foot in 15 minutes? - [Overview of OSMnx](http://geoffboeing.com/2016/11/osmnx-python-street-networks/) - [GitHub repo](https://github.com/gboeing/osmnx) - [Examples, demos, tutorials](https://github.com/gboeing/osmnx-examples) - [Documentation](htt...
github_jupyter
*** *** # 15. 파이썬 함수 *** *** *** ## 1 함수의 정의와 호출 *** - 함수: 여러 개의 Statement들을 하나로 묶은 단위 - 함수 사용의 장점 - 반복적인 수행이 가능하다 - 코드를 논리적으로 이해하는 데 도움을 준다 - 코드의 일정 부분을 별도의 논리적 개념으로 독립화할 수 있음 - 수학에서 복잡한 개념을 하나의 단순한 기호로 대치하는 것과 비슷 ### 1-1 간단한 함수의 정의 - 함수 정의시 사용하는 키워드: def ``` def add(a, b): return a + b print(add(1,...
github_jupyter
``` # Imports import pandas as pd import numpy as np # machine learning from sklearn import svm from sklearn.ensemble import VotingClassifier from sklearn.ensemble import GradientBoostingClassifier from sklearn.ensemble import AdaBoostClassifier from sklearn.model_selection import cross_val_score from sklearn.ensemble...
github_jupyter
# Kmer frequency Bacillus Generate code to embed Bacillus sequences by calculating kmer frequency import to note that this requires biopython version 1.77. Alphabet was deprecated in 1.78 (September 2020). Alternatively we could not reduce the alphabet though the kmer frequency table is sparse so could be a computati...
github_jupyter
# Raven annotations Raven Sound Analysis Software enables users to inspect spectrograms, draw time and frequency boxes around sounds of interest, and label these boxes with species identities. OpenSoundscape contains functionality to prepare and use these annotations for machine learning. ## Download annotated data We...
github_jupyter
# CER043 - Install signed Master certificates This notebook installs into the Big Data Cluster the certificates signed using: - [CER033 - Sign Master certificates with generated CA](../cert-management/cer033-sign-master-generated-certs.ipynb) ## Steps ### Parameters ``` app_name = "master" scaledset_name = "...
github_jupyter
# <span style="color:orange"> Exercise 12.2 </span> ## <span style="color:green"> Task </span> Change the architecture of your DNN using convolutional layers. Use `Conv2D`, `MaxPooling2D`, `Dropout`, but also do not forget `Flatten`, a standard `Dense` layer and `soft-max` in the end. I have merged step 2 and 3 in the...
github_jupyter
``` # To support both python 2 and python 3 from __future__ import division, print_function, unicode_literals # Common imports import os import pickle import timeit # numpy settings import numpy as np np.random.seed(42) # to make this notebook's output stable across runs # pandas settings import pandas as pd pd.set_...
github_jupyter
# Exploring and Processing Data - Part 1 ``` # imports import pandas as pd import numpy as np import os ``` # Import Data ``` # set the path of the raw data raw_data_path = os.path.join(os.path.pardir, 'data', 'raw') train_file_path = os.path.join(raw_data_path, 'train.csv') test_file_path = os.path.join(raw_data_pa...
github_jupyter
# Electiva Técnica I - Introducción *Robot Operating System* (ROS1) ### David Rozo Osorio, I.M, M.Sc. ## Introducción a Linux System - Objetivo: comprender el funcionamiento de un sistema operativo tipo Linux. - Procedimiento: 1. Características de la máquina virtual. 2. Introducción. 3. Características del S.O...
github_jupyter
``` from ei_net import * from ce_net import * import matplotlib.pyplot as plt import datetime as dt %matplotlib inline ########################################## ############ PLOTTING SETUP ############## EI_cmap = "Greys" where_to_save_pngs = "../figs/pngs/" where_to_save_pdfs = "../figs/pdfs/" save = True plt.rc('a...
github_jupyter
<a href="https://colab.research.google.com/github/Lord-Kanzler/DS-Unit-2-Linear-Models/blob/master/module3-ridge-regression/LS_DS_213_assignment_ALEX_KAISER.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Lambda School Data Science *Unit 2, Sprint ...
github_jupyter
``` # HIDDEN from datascience import * from prob140 import * import numpy as np import matplotlib.pyplot as plt plt.style.use('fivethirtyeight') %matplotlib inline import math from scipy import stats ``` ## Moment Generating Functions ## The probability mass function and probability density, cdf, and survival functio...
github_jupyter
# Test differentation Test differentiation of distance functions, by implementing gradient descent. ``` import numpy as np import matplotlib.pyplot as plt from matplotlib import collections, lines, markers, path, patches %matplotlib inline from geometry import * ``` ## Set up 1-D hyperboloid manifold ``` theta = np...
github_jupyter
``` import os import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import PercentFormatter from glob import glob %matplotlib inline ``` # Instructions for Use The "Main Functions" section contains functions which return the success rate to be plotted as well as lower and upper bounds for uncertai...
github_jupyter
``` # import necessary packages import json import requests import pandas as pd import polyline import geopandas as gpd from shapely.geometry import LineString, Point import numpy as np from itertools import product from haversine import haversine, Unit from shapely.ops import nearest_points import os from matplotlib i...
github_jupyter
## 1. Regression discontinuity: banking recovery <p>After a debt has been legally declared "uncollectable" by a bank, the account is considered "charged-off." But that doesn't mean the bank <strong><em>walks away</em></strong> from the debt. They still want to collect some of the money they are owed. The bank will scor...
github_jupyter
``` from scipy.ndimage.measurements import label import numpy as np import json with open(r"C:\data\Dropbox\Projekte\Code\CCC_Linz18Fall\data\level5\level5_2.json", "r") as f: input = json.load(f) grid = np.array(input["rows"]) plt.figure(figsize=(10, 10)) plt.imshow(grid) plt.figure(figsize=(10, 10)) #plt.imshow(...
github_jupyter
# Retrieve Poetry ## Poetry Retriever using the Poly-encoder Transformer architecture (Humeau et al., 2019) for retrieval ``` # This notebook is based on : # https://aritter.github.io/CS-7650/ # This Project was developed at the Georgia Institute of Technology by Ashutosh Baheti (ashutosh.baheti@cc.gatech.edu), # bor...
github_jupyter
# Cruise collocation with gridded data Authors * [Dr Chelle Gentemann](mailto:gentemann@esr.org) - Earth and Space Research, USA * [Dr Marisol Garcia-Reyes](mailto:marisolgr@faralloninstitute.org) - Farallon Institute, USA ------------- # Structure of this tutorial 1. Opening data 1. Collocating satellite da...
github_jupyter
``` from nltk.classify import NaiveBayesClassifier from nltk.corpus import stopwords stopset = list(set(stopwords.words('english'))) import re import csv import nltk.classify def replaceTwoOrMore(s): pattern = re.compile(r"(.)\1{1,}", re.DOTALL) return pattern.sub(r"\1\1", s) def processTweet(tweet): t...
github_jupyter