text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` # -*- coding: utf-8 -*- # เรียกใช้งานโมดูล file_name="data" import codecs from tqdm import tqdm from pythainlp.tokenize import word_tokenize #import deepcut from pythainlp.tag import pos_tag from nltk.tokenize import RegexpTokenizer import glob import nltk import re # thai cut thaicut="newmm" from sklearn_crfsuite ...
github_jupyter
``` import cv2 import numpy as np import matplotlib.pyplot as plt import glob import pandas as pd import os def imshow(img): img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB) plt.imshow(img) def get_lane_mask(sample,lane_idx): points_lane = [] h_max = np.max(data['h_samples'][sample]) h_min = np.min(data['h...
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
## Moodle Database: Educational Data Log Analysis The Moodle LMS is a free and open-source learning management system written in PHP and distributed under the GNU General Public License. It is used for blended learning, distance education, flipped classroom and other e-learning projects in schools, universities, work...
github_jupyter
# Format DataFrame ``` import pandas as pd from sklearn.datasets import make_regression data = make_regression(n_samples=600, n_features=50, noise=0.1, random_state=42) train_df = pd.DataFrame(data[0], columns=["x_{}".format(_) for _ in range(data[0].shape[1])]) train_df["target"] = data[1] print(train_df.shape) tra...
github_jupyter
[source](../../api/alibi_detect.od.isolationforest.rst) # Isolation Forest ## Overview [Isolation forests](https://cs.nju.edu.cn/zhouzh/zhouzh.files/publication/icdm08b.pdf) (IF) are tree based models specifically used for outlier detection. The IF isolates observations by randomly selecting a feature and then rando...
github_jupyter
# Classification models using python and scikit-learn There are many users of online trading platforms and these companies would like to run analytics on and predict churn based on user activity on the platform. Keeping customers happy so they do not move their investments elsewhere is key to maintaining profitability...
github_jupyter
# Fitting distribution with R ``` x.norm <- rnorm(n=200,m=10,sd=2) hist(x.norm,main="Histogram of observed data") plot(density(x.norm),main="Density estimate of data") plot(ecdf(x.norm),main="Empirical cumulative distribution function") z.norm <- (x.norm-mean(x.norm))/sd(x.norm) # standardize data qqnorm(z.norm) ## dr...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns data = pd.read_csv('dataset-of-10s.csv') data.head() ``` # checking basic integrity ``` data.shape data.info() ``` # no. of rows = non null values for each column -> no null value ``` data.head() ``` # checking unique ...
github_jupyter
# PART 3 - Metadata Knowledge Graph creation in Amazon Neptune. Amazon Neptune is a fast, reliable, fully managed graph database service that makes it easy to build and run applications that work with highly connected datasets. The core of Neptune is a purpose-built, high-performance graph database engine. This engine...
github_jupyter
``` import pandas as pd import numpy as np df = pd.DataFrame({'Map': [0,0,0,1,1,2,2], 'Values': [1,2,3,5,4,2,5]}) df['S'] = df.groupby('Map')['Values'].transform(np.sum) df['M'] = df.groupby('Map')['Values'].transform(np.mean) df['V'] = df.groupby('Map')['Values'].transform(np.var) print (df) import numpy as np import...
github_jupyter
<a href="https://colab.research.google.com/github/allanstar-byte/ESTRELLA/blob/master/SQL_WORLD_SUICIDE_ANALYTICS.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # **SQL DATA CLEANING, OUTLIERS AND ANALYTICS** # **1. Connecting to our Database** `...
github_jupyter
``` import json import joblib import pickle import pandas as pd from lightgbm import LGBMClassifier from sklearn.model_selection import train_test_split from sklearn.pipeline import make_pipeline, Pipeline from sklearn.preprocessing import OneHotEncoder from sklearn.compose import ColumnTransformer from sklearn.impute ...
github_jupyter
# Project: Investigate Children Out of School ## Table of Contents <ul> <li><a href="#intro">Introduction</a></li> <li><a href="#wrangling">Data Wrangling</a></li> <li><a href="#eda">Exploratory Data Analysis</a></li> <li><a href="#conclusions">Conclusions</a></li> </ul> <a id='intro'></a> ## Introduction > **Key ...
github_jupyter
# Apache Kafka Integration + Preprocessing / Interactive Analysis with KSQL This notebook uses the combination of Python, Apache Kafka, KSQL for Machine Learning infrastructures. It includes code examples using ksql-python and other widespread components from Python’s machine learning ecosystem, like Numpy, pandas, ...
github_jupyter
# Multi-Layer Perceptron, MNIST --- In this notebook, we will train an MLP to classify images from the [MNIST database](http://yann.lecun.com/exdb/mnist/) hand-written digit database. The process will be broken down into the following steps: >1. Load and visualize the data 2. Define a neural network 3. Train the model...
github_jupyter
# US Production Data for RBC Modeling ``` import pandas as pd import numpy as np import fredpy as fp import matplotlib.pyplot as plt plt.style.use('classic') %matplotlib inline pd.plotting.register_matplotlib_converters() # Load API key fp.api_key = fp.load_api_key('fred_api_key.txt') # Download nominal GDP, nominal ...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import seaborn as sns ``` # Reading QoS analysis raw info Temporarily, this info is saved in a CSV file but it will be in the database **qos_analysis_13112018.csv** - columns = ['url','protocol','code','start','end','duration','runid'] - First try of qos analysi...
github_jupyter
<a href="https://colab.research.google.com/github/neurorishika/PSST/blob/master/Tutorial/Day%205%20Optimal%20Mind%20Control/Day%205.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> &nbsp; <a href="https://kaggle.com/kernels/welcome?src=https://raw.git...
github_jupyter
# 📝 Exercise M6.03 This exercise aims at verifying if AdaBoost can over-fit. We will make a grid-search and check the scores by varying the number of estimators. We will first load the California housing dataset and split it into a training and a testing set. ``` from sklearn.datasets import fetch_california_housin...
github_jupyter
# SmallPebble [![](https://github.com/sradc/smallpebble/workflows/Python%20package/badge.svg)](https://github.com/sradc/smallpebble/commits/) **Project status: unstable.** <br><p align="center"><img src="https://raw.githubusercontent.com/sradc/SmallPebble/master/pebbles.jpg"/></p><br> SmallPebble is a minimal auto...
github_jupyter
``` import rioxarray as rio import xarray as xr import glob import os import numpy as np import requests import geopandas as gpd from pathlib import Path from datetime import datetime from rasterio.enums import Resampling import matplotlib.pyplot as plt %matplotlib inline site = "BRC" # Change site name chirps_seas_o...
github_jupyter
# ChainerRL Quickstart Guide This is a quickstart guide for users who just want to try ChainerRL for the first time. If you have not yet installed ChainerRL, run the command below to install it: ``` %%bash pip install chainerrl ``` If you have already installed ChainerRL, let's begin! First, you need to import nec...
github_jupyter
# Advanced Usage Exampes for Seldon Client ## Istio Gateway Request with token over HTTPS - no SSL verification Test against a current kubeflow cluster with Dex token authentication. 1. Install kubeflow with Dex authentication ``` INGRESS_HOST=!kubectl -n istio-system get service istio-ingressgateway -o jsonpath='...
github_jupyter
<table width="100%"> <tr style="border-bottom:solid 2pt #009EE3"> <td style="text-align:left" width="10%"> <a href="prepare_anaconda.dwipynb" download><img src="../../images/icons/download.png"></a> </td> <td style="text-align:left" width="10%"> <a href="https://mybin...
github_jupyter
# Testing cosmogan April 19, 2021 Borrowing pieces of code from : - https://github.com/pytorch/tutorials/blob/11569e0db3599ac214b03e01956c2971b02c64ce/beginner_source/dcgan_faces_tutorial.py - https://github.com/exalearn/epiCorvid/tree/master/cGAN ``` import os import random import logging import sys import torch ...
github_jupyter
``` %matplotlib inline ``` # Decoding in time-frequency space using Common Spatial Patterns (CSP) The time-frequency decomposition is estimated by iterating over raw data that has been band-passed at different frequencies. This is used to compute a covariance matrix over each epoch or a rolling time-window and extra...
github_jupyter
## week03: Логистическая регрессия и анализ изображений В этом ноутбуке предлагается построить классификатор изображений на основе логистической регрессии. *Забегая вперед, мы попробуем решить задачу классификации изображений используя лишь простые методы. В третьей части нашего курса мы вернемся к этой задаче.* `...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from scipy.io import loadmat from scipy.interpolate import RectBivariateSpline as rbs from scipy.integrate import romb import scipy.sparse as sp import os import pywt wvt = 'db12' %matplotlib inline import matplotlib as mpl norm = mpl.colors.Normalize(vmin=0.0,vmax...
github_jupyter
## Reinforcement Learning for seq2seq This time we'll solve a problem of transribing hebrew words in english, also known as g2p (grapheme2phoneme) * word (sequence of letters in source language) -> translation (sequence of letters in target language) Unlike what most deep learning practicioners do, we won't only tr...
github_jupyter
# DEAP DEAP is a novel evolutionary computation framework for rapid prototyping and testing of ideas. It seeks to make algorithms explicit and data structures transparent. It works in perfect harmony with parallelisation mechanism such as multiprocessing and SCOOP. The following documentation presents the key concepts...
github_jupyter
``` # !wget https://malaya-dataset.s3-ap-southeast-1.amazonaws.com/crawler/academia/academia-pdf.json import json import cleaning from tqdm import tqdm with open('../academia/academia-pdf.json') as fopen: pdf = json.load(fopen) len(pdf) import os os.path.split(pdf[0]['file']) import malaya fast_text = malaya...
github_jupyter
<a href="https://colab.research.google.com/github/csy99/dna-nn-theory/blob/master/supervised_UCI_adam256_save_embedding.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 import matplotlib import matplotlib.py...
github_jupyter
``` import pandas as pd import numpy as np import os import math import graphlab import graphlab as gl import graphlab.aggregate as agg from graphlab import SArray '''钢炮''' path = '/home/zongyi/bimbo_data/' train = gl.SFrame.read_csv(path + 'train_lag5.csv', verbose=False) town = gl.SFrame.read_csv(path + 'towns.csv', ...
github_jupyter
## Multi-label classification ``` %reload_ext autoreload %autoreload 2 %matplotlib inline from fastai.conv_learner import * PATH = 'data/planet/' # Data preparation steps if you are using Crestle: os.makedirs('data/planet/models', exist_ok=True) os.makedirs('/cache/planet/tmp', exist_ok=True) !ln -s /datasets/kaggle...
github_jupyter
``` from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.layers import Embedding, LSTM, Dense, Dropout, Bidirectional from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.models import Sequential from tensorflow.keras.optimizers import Adam from tensorflow.k...
github_jupyter
# sentinelRequest sentinelRequest can be used to colocate a geodataframe (ie areas, trajectories, buoys, etc ...) with sentinel (1, but also 2 , 3 : all known by scihub) ## Install ``` conda install -c conda-forge lxml numpy geopandas shapely requests fiona matplotlib jupyter descartes pip install --upgrade git+ht...
github_jupyter
``` library(data.table) library(dplyr) library(Matrix) library(BuenColors) library(stringr) library(cowplot) library(SummarizedExperiment) library(chromVAR) library(BSgenome.Hsapiens.UCSC.hg19) library(JASPAR2016) library(motifmatchr) library(GenomicRanges) library(irlba) library(cicero) library(umap) library(cisTopic)...
github_jupyter
``` # default_exp learner ``` # Learner > This contains fastai Learner extensions. ``` #export from tsai.imports import * from tsai.data.core import * from tsai.data.validation import * from tsai.models.all import * from tsai.models.InceptionTimePlus import * from fastai.learner import * from fastai.vision.models.a...
github_jupyter
# Experiment with variables of given high correlation structure This notebook is meant to address to a shared concern from two referees. The [motivating example](motivating_example.html) in the manuscript was designed to be a simple toy for illustrating the novel type of inference SuSiE offers. Here are some slightly ...
github_jupyter
## Analyzing Hamlet ``` %load_ext autoreload %autoreload 2 import src.data import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import os from collections import OrderedDict from IPython.display import display pd.options.display.max_rows = 999 pd.options.display.max_columns = ...
github_jupyter
``` import sys sys.path.append(r'C:\Users\moallemie\EMAworkbench-master') sys.path.append(r'C:\Users\moallemie\EM_analysis') import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from ema_workbench import load_results, ema_logging from ema_workbench.em_framework.salib_samplers imp...
github_jupyter
# Neural Transfer ## Input images ``` %matplotlib inline import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from PIL import Image import matplotlib.pyplot as plt import torchvision.transforms as transforms import torchvision.models as models import co...
github_jupyter
# Lab: Working with a real world data-set using SQL and Python ## Introduction This notebook shows how to work with a real world dataset using SQL and Python. In this lab you will: 1. Understand the dataset for Chicago Public School level performance 1. Store the dataset in an Db2 database on IBM Cloud instance 1. R...
github_jupyter
<center> <img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/Logos/organization_logo/organization_logo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # Access DB2 on Cloud using Python Estimated time needed: **15** minutes ## Objectives After completing this l...
github_jupyter
``` import folium import branca import geopandas from folium.plugins import Search print(folium.__version__) ``` Let's get some JSON data from the web - both a point layer and a polygon GeoJson dataset with some population data. ``` states = geopandas.read_file( 'https://rawcdn.githack.com/PublicaMundi/MappingA...
github_jupyter
# NumPy Tutorial: Data analysis with Python [Source](https://www.dataquest.io/blog/numpy-tutorial-python/) NumPy is a commonly used Python data analysis package. By using NumPy, you can speed up your workflow, and interface with other packages in the Python ecosystem, like scikit-learn, that use NumPy under the hood. ...
github_jupyter
``` %matplotlib inline import numpy as np import yt ``` This notebook shows how to use yt to make plots and examine FITS X-ray images and events files. ## Sloshing, Shocks, and Bubbles in Abell 2052 This example uses data provided by [Scott Randall](http://hea-www.cfa.harvard.edu/~srandall/), presented originally i...
github_jupyter
tobac example: Tracking deep convection based on OLR from geostationary satellite retrievals == This example notebook demonstrates the use of tobac to track isolated deep convective clouds based on outgoing longwave radiation (OLR) calculated based on a combination of two different channels of the GOES-13 imaging inst...
github_jupyter
# Building a Fraud Prediction Model with EvalML In this demo, we will build an optimized fraud prediction model using EvalML. To optimize the pipeline, we will set up an objective function to minimize the percentage of total transaction value lost to fraud. At the end of this demo, we also show you how introducing the...
github_jupyter
##### Copyright 2019 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
# Imports ``` from tensorflow.keras.models import Model from tensorflow.keras.layers import Dense, Dropout, Flatten, Input, Concatenate from tensorflow.keras.optimizers import Adam, RMSprop import numpy as np import matplotlib.pyplot as plt import copy ``` # Global Variables ``` epochs = 500 batch_size = 16 number_o...
github_jupyter
# Field operations There are several convenience methods that can be used to analyse the field. Let us first define the mesh we are going to work with. ``` import discretisedfield as df p1 = (-50, -50, -50) p2 = (50, 50, 50) n = (2, 2, 2) mesh = df.Mesh(p1=p1, p2=p2, n=n) ``` We are going to initialise the vector f...
github_jupyter
# [NTDS'19] tutorial 5: machine learning with scikit-learn [ntds'19]: https://github.com/mdeff/ntds_2019 [Nicolas Aspert](https://people.epfl.ch/nicolas.aspert), [EPFL LTS2](https://lts2.epfl.ch). * Dataset: [digits](https://archive.ics.uci.edu/ml/datasets/Pen-Based+Recognition+of+Handwritten+Digits) * Tools: [scikit...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.preprocessing import StandardScaler from scipy.stats import kurtosis from sklearn.decomposition import PCA import seaborn as sns from scipy.stats import pearsonr %matplotlib gov_pop_area_data = pd.read_excel('/Users/Rohil/Documents/...
github_jupyter
``` import torch from torch import optim import torch.nn as nn import torch.nn.functional as F import torch.autograd as autograd from torch.autograd import Variable from sklearn.preprocessing import OneHotEncoder import os, math, glob, argparse from utils.torch_utils import * from utils.utils import * from mpradragonn...
github_jupyter
``` import os import sys sys.path.append('../') import numpy as np import matplotlib.pyplot as plt import pandas as pd from pprint import pprint from scipy.optimize import curve_fit import src.io as sio import src.preprocessing as spp import src.fitting as sft AFM_FOLDER = sio.get_folderpath("20200818_Akiyama_AFM") A...
github_jupyter
<a href="https://colab.research.google.com/github/yarusx/cat-vs-dogo/blob/main/cat_vs_dog_0_0_2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import matplotlib.pyplot as plt import numpy as np import os import tensorflow as tf from tensorflow...
github_jupyter
``` # some_file.py import sys # insert at 1, 0 is the script path (or '' in REPL) sys.path.insert(1, "/Users/dhruvbalwada/work_root/sogos/") import os from numpy import * import pandas as pd import xarray as xr import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np from xgcm import Grid from xgcm....
github_jupyter
# User testing for for Scikit-Yellowbrick ### Using data that was recorded from sensors during Data Science Certificate Program at GW https://github.com/georgetown-analytics/classroom-occupancy Data consist of temperature, humidity, CO2 levels, light, # of bluetooth devices, noise levels and count of people in the r...
github_jupyter
# 5. Putting it all together **Bring together all of the skills you acquired in the previous chapters to work on a real-life project. From connecting to a database and populating it, to reading and querying it.** It's time to put all your effort so far to good use on a census case study. ### Census case study The cas...
github_jupyter
# Prepare environment ``` !pip install git+https://github.com/katarinagresova/ensembl_scraper.git@6d3bba8e6be7f5ead58a3bbaed6a4e8cd35e62fd ``` # Create config file ``` import yaml config = { "root_dir": "../../datasets/", "organisms": { "homo_sapiens": { "regulatory_feature" } ...
github_jupyter
``` import nltk import pandas as pd import numpy as np import matplotlib.pyplot as plt from nltk.stem import WordNetLemmatizer from nltk.corpus import wordnet import re, collections from collections import defaultdict from sklearn.feature_extraction.text import CountVectorizer from sklearn.metrics import mean_squared_e...
github_jupyter
# Hello Segmentation A very basic introduction to using segmentation models with OpenVINO. We use the pre-trained [road-segmentation-adas-0001](https://docs.openvinotoolkit.org/latest/omz_models_model_road_segmentation_adas_0001.html) model from the [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/)...
github_jupyter
``` from __future__ import print_function import math from IPython import display from matplotlib import cm from matplotlib import gridspec from matplotlib import pyplot as plt import numpy as np import pandas as pd from sklearn import metrics import tensorflow as tf from tensorflow.python.data import Dataset tf.log...
github_jupyter
``` import os import torch from torch.utils.data import DataLoader, Dataset from torchvision.transforms import ToTensor, ToPILImage from torchvision.models.detection import fasterrcnn_resnet50_fpn from torchvision.models.detection.faster_rcnn import FastRCNNPredictor from PIL import Image class PlayerDataset(Dataset): ...
github_jupyter
``` !git clone https://github.com/GraphGrailAi/ruGPT3-ZhirV cd ruGPT3-ZhirV cd .. !pip3 install -r requirements.txt ``` Обучение эссе !python pretrain_transformers.py \ --output_dir=/home/jovyan/ruGPT3-ZhirV/ \ --overwrite_output_dir \ --model_type=gpt2 \ --model_name_or_path=sberbank-ai/rugpt3large_b...
github_jupyter
``` # Copyright 2022 Google LLC. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
github_jupyter
``` import torch import torch.nn as nn import onmt import onmt.inputters import onmt.modules import onmt.utils ``` We begin by loading in the vocabulary for the model of interest. This will let us check vocab size and to get the special ids for padding. ``` vocab = dict(torch.load("../../data/data.vocab.pt")) src_pa...
github_jupyter
# 决策树 - 非参数学习算法 - 天然解决多分类问题 - 也可以解决回归问题 - 非常好的可解释性 ``` import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import cross_val_score from sklearn import datasets iris = datasets.load_iris() print(iris.DESCR) X = iris.data[:, 2:] # 取后两个特征 y = iris.target plt.scatter(X[y==0, 0], X[y==0, 1]) pl...
github_jupyter
``` import pandas as pd import numpy as np from PIL import Image import os import sys !pip install ipython-autotime %load_ext autotime %matplotlib inline ``` 1. Extract your dataset and split into train_x, train_y, test_x and test_y. 2. Execute the following cells --- ## Hybrid Social Group Optimization ---...
github_jupyter
# ClusterFinder Reference genomes reconstruction This notebook validates the 10 genomes we obtained from NCBI based on the ClusterFinder supplementary table. We check that the gene locations from the supplementary table match locations in the GenBank files. ``` from Bio import SeqIO from Bio.SeqFeature import Featu...
github_jupyter
# Realization of Recursive Filters *This jupyter notebook is part of a [collection of notebooks](../index.ipynb) on various topics of Digital Signal Processing. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sascha.Spors@uni-rostock.de).* ## Cascaded Structures The realization of rec...
github_jupyter
# Utilizing daal4py in Data Science Workflows The notebook below has been made to demonstrate daal4py in a data science context. It utilizes a Cycling Dataset for pyworkout-toolkit, and attempts to create a linear regression model from the 5 features collected for telemetry to predict the user's Power output in the a...
github_jupyter
# **JIVE: Joint and Individual Variation Explained** JIVE (Joint and Individual Variation Explained) is a dimensional reduction algorithm that can be used when there are multiple data matrices (data blocks). The multiple data block setting means there are $K$ different data matrices, with the same number of observatio...
github_jupyter
``` import tensorflow as tf from tensorflow.keras import layers, Model from tensorflow.keras.activations import relu from tensorflow.keras.models import Sequential, load_model from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping from tensorflow.keras.losses import BinaryCrossentropy from tensorflow.ker...
github_jupyter
An illustration of the metric and non-metric MDS on generated noisy data. The reconstructed points using the metric MDS and non metric MDS are slightly shifted to avoid overlapping. #### New to Plotly? Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloadi...
github_jupyter
# Python datetime module We will look at an important standard library, the [datetime library][1] which contains many powerful functions to support date, time and datetime manipulation. Pandas does not rely on this object and instead creates its own, a `Timestamp`, discussed in other notebooks. The datetime library i...
github_jupyter
``` import numpy as np import pandas as pd import time import os from pyspark.ml.clustering import KMeans from pyspark.ml.evaluation import ClusteringEvaluator from pyspark.ml.linalg import Vectors from matplotlib import pyplot as plt from pyspark.sql import SparkSession # from pyspark.ml.clustering import KMeans, K...
github_jupyter
# Multi-wavelength maps New in version `0.2.1` is the ability for users to instantiate wavelength-dependent maps. Nearly all of the computational overhead in `starry` comes from computing rotation matrices and integrals of the Green's basis functions, which makes it **really** fast to compute light curves at different ...
github_jupyter
# Fingerprint Generators ## Creating and using a fingerprint generator Fingerprint generators can be created by using the functions that return the type of generator desired. ``` from rdkit import Chem from rdkit.Chem import rdFingerprintGenerator mol = Chem.MolFromSmiles('CC(O)C(O)(O)C') generator = rdFingerprintG...
github_jupyter
# Part 3: Launch a Grid Network Locally In this tutorial, you'll learn how to deploy a grid network into a local machine and then interact with it using PySyft. _WARNING: Grid nodes publish datasets online and are for EXPERIMENTAL use only. Deploy nodes at your own risk. Do not use OpenGrid with any data/models you w...
github_jupyter
#### Reactions processing with AQME - substrates + TS ``` # cell with import, system name and PATHs import os, glob, subprocess import shutil from pathlib import Path from aqme.csearch import csearch from aqme.qprep import qprep from aqme.qcorr import qcorr from rdkit import Chem import pandas as pd ``` ###### Step 1...
github_jupyter
``` import sys sys.path.append('../../code/') import os import json from datetime import datetime import time from math import * import numpy as np import pandas as pd import matplotlib.pyplot as plt import scipy.stats as stats import igraph as ig import networkx as nx from load_data import load_citation_network, c...
github_jupyter
## Download and extract zip from web - Specifies the source link, destination url and file name to download and extract data files - Currently reading from external folder as github does not support large files - To rerun function for testing before submission - To add checks and conditions for the function - ...
github_jupyter
``` import numpy as np from bokeh.plotting import figure, output_file, show from bokeh.io import output_notebook from nsopy import SGMDoubleSimpleAveraging as DSA from nsopy.loggers import EnhancedDualMethodLogger output_notebook() %cd .. from smpspy.oracles import TwoStage_SMPS_InnerProblem ``` # Solving dual mod...
github_jupyter
## Imperfect Tests and The Effects of False Positives The US government has been widely criticized for its failure to test as many of its citizens for COVID-19 infections as other countries. But is mass testing really as easy as it seems? This analysis of the false positive and false negative rates of tests, using pub...
github_jupyter
<h1>Model Deployment</h1> Once we have built and trained our models for feature engineering (using Amazon SageMaker Processing and SKLearn) and binary classification (using the XGBoost open-source container for Amazon SageMaker), we can choose to deploy them in a pipeline on Amazon SageMaker Hosting, by creating an In...
github_jupyter
# SimFin Test All Datasets This Notebook performs automated testing of all the bulk datasets from SimFin. The datasets are first downloaded from the SimFin server and then various tests are performed on the data. An exception is raised if any problems are found. This Notebook can be run as usual if you have `simfin` ...
github_jupyter
![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/streamlit_notebooks/healthcare/NER_LEGAL_DE.ipynb) # **Detect legal entitie...
github_jupyter
Let's design a LNA using Infineon's BFU520 transistor. First we need to import scikit-rf and a bunch of other utilities: ``` import numpy as np import skrf from skrf.media import DistributedCircuit import skrf.frequency as freq import skrf.network as net import skrf.util import matplotlib.pyplot as plt %matplotlib...
github_jupyter
# Model Selection ![Data Science Workflow](img/ds-workflow.png) ## Model Selection - The process of selecting the model among a collection of candidates machine learning models ### Problem type - What kind of problem are you looking into? - **Classification**: *Predict labels on data with predefined classes* ...
github_jupyter
``` import numpy as np arr = np.load('MAPS.npy') print(arr) print(np.shape(arr)) arr2 = np.empty((20426, 88), dtype = int) for i in range(arr.shape[0]): for j in range(arr.shape[1]): if arr[i,j]==False: arr2[i,j]=int(0) int(arr2[i,j]) elif arr[i,j]==True: arr2[i,...
github_jupyter
``` # Necessary imports import warnings warnings.filterwarnings('ignore') import re import os import numpy as np import scipy as sp from scipy.sparse import csr_matrix from sklearn import datasets from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer fr...
github_jupyter
# Python course Day 4 ## Dictionaries ``` student = {"number": 570, "name":"Simon", "age":23, "height":165} print(student) print(student['name']) print(student['age']) my_list = {1: 23, 2:56, 3:78, 4:14, 5:67} my_list[1] my_list.keys() my_list.values() student.keys() student.values() student['number'] = 111 print(stu...
github_jupyter
## Statistical Analysis We have learned null hypothesis, and compared two-sample test to check whether two samples are the same or not To add more to statistical analysis, the follwoing topics should be covered: 1- Approxite the histogram of data with combination of Gaussian (Normal) distribution functions: Gau...
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 class MosaicDa...
github_jupyter
<a href="http://landlab.github.io"><img style="float: left" src="../../landlab_header.png"></a> # Using plotting tools associated with the Landlab NetworkSedimentTransporter component <hr> <small>For more Landlab tutorials, click here: <a href="https://landlab.readthedocs.io/en/latest/user_guide/tutorials.html">http...
github_jupyter
- Scipy의 stats 서브 패키지에 있는 binom 클래스는 이항 분포 클래스이다. n 인수와 p 인수를 사용하여 모수를 설정한다 ``` N = 10 theta = 0.6 rv = sp.stats.binom(N, theta) rv ``` - pmf 메서드를 사용하면, 확률 질량 함수 (pmf: probability mass function)를 계산할 수 있다. ``` %matplotlib inline xx = np.arange(N + 1) plt.bar(xx, rv.pmf(xx), align='center') plt.ylabel('p(x)') plt.tit...
github_jupyter
<table style="float:left; border:none"> <tr style="border:none; background-color: #ffffff"> <td style="border:none"> <a href="http://bokeh.pydata.org/"> <img src="assets/bokeh-transparent.png" style="width:50px" > </a> ...
github_jupyter