text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` import pandas as pd from lifelines import KaplanMeierFitter import seaborn as sns import matplotlib.pyplot as plt preprints_df = pd.read_csv("output/biorxiv_article_metadata.tsv", sep="\t",) preprints_df["date_received"] = pd.to_datetime(preprints_df["date_received"]) xml_df = ( preprints_df.sort_values(by="dat...
github_jupyter
# Use BlackJAX with Numpyro BlackJAX can take any log-probability function as long as it is compatible with JAX's JIT. In this notebook we show how we can use Numpyro as a modeling language and BlackJAX as an inference library. We reproduce the Eight Schools example from the [Numpyro documentation](https://github.com...
github_jupyter
# 1. Import libraries ``` #----------------------------Reproducible---------------------------------------------------------------------------------------- import numpy as np import tensorflow as tf import random as rn import os seed=0 os.environ['PYTHONHASHSEED'] = str(seed) np.random.seed(seed) rn.seed(seed) #sess...
github_jupyter
``` import h5py import numpy as np files = ['../Data/ModelNet40_train/ply_data_train0.h5', '../Data/ModelNet40_train/ply_data_train1.h5', '../Data/ModelNet40_train/ply_data_train2.h5', '../Data/ModelNet40_train/ply_data_train3.h5', '../Data/ModelNet40_train/ply_data_train4.h5'] #fil...
github_jupyter
# Sorting ### 1. Bubble: $O(n^2)$ repeatedly swapping the adjacent elements if they are in wrong order ### 2. Selection: $O(n^2)$ find largest number and place it in the correct order ### 3. Insertion: $O(n^2)$ ### 4. Shell: $O(n^2)$ ### 5. Merge: $O(n \log n)$ ### 6. Quick: $O(n \log n)$ it is important to select prop...
github_jupyter
# Physically labeled data: pyfocs single-ended examples Finally, after all of that (probably confusing) work we can map the data to physical coordinates. ``` import xarray as xr import pyfocs import os ``` # 1. Load data ## 1.1 Configuration files As in the previous example we will load and prepare the configurati...
github_jupyter
# Machine Translation English-German Example Using SageMaker Seq2Seq 1. [Introduction](#Introduction) 2. [Setup](#Setup) 3. [Download dataset and preprocess](#Download-dataset-and-preprocess) 3. [Training the Machine Translation model](#Training-the-Machine-Translation-model) 4. [Inference](#Inference) ## Introductio...
github_jupyter
# Let's Grow your Own Inner Core! ### Choose a model in the list: - geodyn_trg.TranslationGrowthRotation() - geodyn_static.Hemispheres() ### Choose a proxy type: - age - position - phi - theta - growth rate ### set the parameters for the model : geodynModel.set_parameters(parameters) ###...
github_jupyter
<a href="https://colab.research.google.com/github/danzerzine/seospider-colab/blob/main/Running_screamingfrog_SEO_spider_in_Colab_notebook.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Запуск SEO бота Screaming Frog SEO spider в облаке через Goog...
github_jupyter
## _*Using Qiskit Aqua for clique problems*_ This Qiskit Aqua Optimization notebook demonstrates how to use the VQE quantum algorithm to compute the clique of a given graph. The problem is defined as follows. A clique in a graph $G$ is a complete subgraph of $G$. That is, it is a subset $K$ of the vertices such that...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt ``` # 1. Деревья решений для классификации (продолжение) На прошлом занятии мы разобрали идею Деревьев решений: ![DecisionTree](tree1.png) Давайте теперь разберемся **как происходит разделения в каждом узле** то есть как проходит этап **об...
github_jupyter
``` import re import numpy as np import pandas as pd import collections from sklearn import metrics from sklearn.preprocessing import LabelEncoder import tensorflow as tf from sklearn.model_selection import train_test_split from unidecode import unidecode from tqdm import tqdm import time rules_normalizer = { 'expe...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np import scipy.special import copy def empty_mask(size): return np.zeros((size,size)) def circular_mask(size): y,x = np.mgrid[:size, :size] M = np.zeros((size,size)) x0 = y0 = (size-1)/2 r = size/4 M[(x-x0)**2+(y-y0)**2<=r**2]=1 return ...
github_jupyter
This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges). # Challenge Notebook ## Problem: Given an array of (unix_timestamp, num_people, EventType.ENTER or EventType.EXIT), find the busiest perio...
github_jupyter
<a href="https://qworld.net" target="_blank" align="left"><img src="../qworld/images/header.jpg" align="left"></a> $ \newcommand{\bra}[1]{\langle #1|} $ $ \newcommand{\ket}[1]{|#1\rangle} $ $ \newcommand{\braket}[2]{\langle #1|#2\rangle} $ $ \newcommand{\dot}[2]{ #1 \cdot #2} $ $ \newcommand{\biginner}[2]{\left\langle...
github_jupyter
# Datasets and Neural Networks This notebook will step through the process of loading an arbitrary dataset in PyTorch, and creating a simple neural network for regression. # Datasets We will first work through loading an arbitrary dataset in PyTorch. For this project, we chose the <a href="http://www.cs.toronto.edu/~d...
github_jupyter
# Optimization with equality constraints ``` import math import numpy as np from scipy import optimize as opt ``` maximize $.4\,\log(x_1)+.6\,\log(x_2)$ s.t. $x_1+3\,x_2=50$. ``` I = 50 p = np.array([1, 3]) U = lambda x: (.4*math.log(x[0])+.6*math.log(x[1])) x0 = (I/len(p))/np.array(p) budget = ({'type': 'eq', 'fun'...
github_jupyter
``` import sys sys.path.append('../') %load_ext autoreload %autoreload 2 import sklearn import copy import numpy as np import seaborn as sns sns.set() import scipy as sp import pandas as pd import matplotlib.pyplot as plt import matplotlib.dates as mdates import seaborn as sns # from viz import viz from bokeh.plotti...
github_jupyter
``` #IMPORT SEMUA LIBARARY #IMPORT LIBRARY PANDAS import pandas as pd #IMPORT LIBRARY UNTUK POSTGRE from sqlalchemy import create_engine import psycopg2 #IMPORT LIBRARY CHART from matplotlib import pyplot as plt from matplotlib import style #IMPORT LIBRARY BASE PATH import os import io #IMPORT LIBARARY PDF from fpdf im...
github_jupyter
``` import os import random import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim as optim import torch.utils.data import torchvision.datasets as dset import torchvision.transforms as transforms import torchvision.utils as vutils import numpy as np import ma...
github_jupyter
# SAMUR Emergency Frequencies This notebook explores how the frequency of different types of emergency changes with time in relation to different periods (hours of the day, days of the week, months of the year...) and locations in Madrid. This will be useful for constructing a realistic emergency generator in the city...
github_jupyter
``` import numpy as np import tensorflow as tf from sklearn.utils import shuffle import re import time import collections import os def build_dataset(words, n_words, atleast=1): count = [['PAD', 0], ['GO', 1], ['EOS', 2], ['UNK', 3]] counter = collections.Counter(words).most_common(n_words) counter = [i for...
github_jupyter
# S3Fs Notebook Example S3Fs is a Pythonic file interface to S3. It builds on top of botocore. The top-level class S3FileSystem holds connection information and allows typical file-system style operations like cp, mv, ls, du, glob, etc., as well as put/get of local files to/from S3. The connection can be anonymous -...
github_jupyter
``` # 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 under t...
github_jupyter
# 1 - Sequence to Sequence Learning with Neural Networks In this series we'll be building a machine learning model to go from once sequence to another, using PyTorch and torchtext. This will be done on German to English translations, but the models can be applied to any problem that involves going from one sequence to...
github_jupyter
``` #!pip install pandas_profiling #!pip install matplotlib import sys sys.version import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline import scipy.stats as stats import pandas_profiling %matplotlib inline plt.rcParams['figure.figsize'] = 10, 7.5 plt.rcParam...
github_jupyter
## Data and Training The **augmented** cough audio dataset of the [Project Coswara](https://coswara.iisc.ac.in/about) was used to train the deep CNN model. The preprocessing steps and CNN architecture is as shown below. The training code is concealed on Github to protect the exact hyperparameters and maintain perform...
github_jupyter
# Scraping and Parsing: EAD XML Finding Aids from the Library of Congress ``` import os from urllib.request import urlopen from bs4 import BeautifulSoup import subprocess ## Creating a directory called 'LOC_Metadata' and setting it as our current working directory !mkdir /sharedfolder/LOC_Metadata os.chdir('/sharedf...
github_jupyter
## Dependencies ``` import warnings, glob from tensorflow.keras import Sequential, Model from cassava_scripts import * seed = 0 seed_everything(seed) warnings.filterwarnings('ignore') ``` ### Hardware configuration ``` # TPU or GPU detection # Detect hardware, return appropriate distribution strategy strategy, tpu...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # Training Pipeline - Custom Script _**Training many models using a custom script**_ ---- This notebook demonstrates how to create a pipeline that trains and registers many models using a custom script. We utilize the [Paralle...
github_jupyter
# Amazon SageMaker Object Detection for Bird Species 1. [Introduction](#Introduction) 2. [Setup](#Setup) 3. [Data Preparation](#Data-Preparation) 1. [Download and unpack the dataset](#Download-and-unpack-the-dataset) 2. [Understand the dataset](#Understand-the-dataset) 3. [Generate RecordIO files](#Generate-Reco...
github_jupyter
# Test ``` import fastai.train import pandas as pd import torch import torch.nn as nn from captum.attr import LayerIntegratedGradients # --- Model Setup --- # Load a fast.ai `Learner` trained to predict IMDB review category `[negative, positive]` awd = fastai.train.load_learner(".", "imdb_fastai_trained_lm_clf.pth")...
github_jupyter
# Repertoire classification subsampling When training a classifier to assign repertoires to the subject from which they were obtained, we need a set of subsampled sequences. The sequences have been condensed to just the V- and J-gene assignments and the CDR3 length (VJ-CDR3len). Subsample sizes range from 10 to 10,000...
github_jupyter
# Strata objects: Legend and Column Strata is stratigraphic data. The main object of `strata` submodule is `mplStrater.strata.Column` which represents the single stratigraphic column. This example shows the structure of the class and how to use it. First, import all required packages and load the example dataset. `...
github_jupyter
Sometimes it is useful to take a random choice between two or more options. Numpy has a function for that, called `random.choice`: ``` import numpy as np ``` Say we want to choose randomly between 0 and 1. We want an equal probability of getting 0 and getting 1. We could do it like this: ``` np.random.randint(0, ...
github_jupyter
``` package_jar = '../target/spark-data-repair-plugin_2.12_spark3.2_0.1.0-EXPERIMENTAL-with-dependencies.jar' import numpy as np import pandas as pd from pyspark.sql import * from pyspark.sql.types import * from pyspark.sql import functions as f spark = SparkSession.builder \ .config('spark.jars', package_jar) \ ...
github_jupyter
# Capsule Network In this notebook i will try to explain and implement Capsule Network. MNIST images will be used as an input. To implement capsule Network, we need to understand what are capsules first and what advantages do they have compared to convolutional neural network. ### so what are capsules? * Briefly ex...
github_jupyter
# Scenario Analysis: Pop Up Shop ![](https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Weich_Couture_Alpaca%2C_D%C3%BCsseldorf%2C_December_2020_%2809%29.jpg/300px-Weich_Couture_Alpaca%2C_D%C3%BCsseldorf%2C_December_2020_%2809%29.jpg) Kürschner (talk) 17:51, 1 December 2020 (UTC), CC0, via Wikimedia Commons `...
github_jupyter
``` !wget --no-check-certificate \ https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip \ -O cats_and_dogs_filtered.zip ! unzip cats_and_dogs_filtered.zip import keras,os from keras.models import Sequential from keras.layers import Dense, Conv2D, MaxPool2D , Flatten from keras.preprocessing.imag...
github_jupyter
<!-- Copyright 2015 Google Inc. All rights reserved. --> <!-- Licensed under the Apache License, Version 2.0 (the "License"); --> <!-- you may not use this file except in compliance with the License. --> <!-- You may obtain a copy of the License at --> <!-- http://www.apache.org/licenses/LICENSE-2.0 --> <!-- Unl...
github_jupyter
``` import csv from pprint import pprint import random import numpy as np alphabet = ['', 'ا', 'ب', 'ت', 'ث','ج','ح', 'خ', 'د','ذ','ر','ز', 'س','ش','ص', 'ض','ط','ظ','ع','غ','ف','ق', 'ك','ل','م','ن','ه','و','ي', 'ء','ى','أ','ؤ'] def xalphabetin(char): num...
github_jupyter
## Data Preperation for the first Model Welcome to the first notebook. Here we'll process the data from downloading to what we will be using to train our first model - **'Wh’re Art Thee Min’ral?'**. The steps we'll be following here are: - Downloading the SARIG Geochem Data Package. **(~350 Mb)** - Understanding the d...
github_jupyter
# Black-Scholes Algorithm Using Numba-dppy ## Sections - [Black Sholes algorithm](#Black-Sholes-algorithm) - _Code:_ [Implementation of Black Scholes targeting CPU using Numba JIT](#Implementation-of-Black-Scholes-targeting-CPU-using-Numba-JIT) - _Code:_ [Implementation of Black Scholes targeting GPU using Kernels](#I...
github_jupyter
``` # Pandas for managing datasets import pandas as pd # seaborn for plotting and styling import seaborn as sns import matplotlib.pyplot as plt import numpy as np # read dataset tips = sns.load_dataset("tips") # a preview of the data tips.head() # make a copy of the data to create the graphs of df = tips.copy() df # cr...
github_jupyter
TSG097 - Get BDC stateful sets (Kubernetes) =========================================== Description ----------- Steps ----- ### Common functions Define helper functions used in this notebook. ``` # Define `run` function for transient fault handling, suggestions on error, and scrolling updates on Windows import sys...
github_jupyter
## Trajectory equations: ``` %matplotlib inline import matplotlib.pyplot as plt from sympy import * init_printing() Bx, By, Bz, B = symbols("B_x, B_y, B_z, B") x, y, z = symbols("x, y, z" ) x_0, y_0, z_0 = symbols("x_0, y_0, z_0") vx, vy, vz, v = symbols("v_x, v_y, v_z, v") vx_0, vy_0, vz_0 = symbols("v_x0, v_y0, v_z0...
github_jupyter
# 人力规划 等级:高级 ## 目的和先决条件 此模型是人员编制问题的一个示例。在人员编制计划问题中,必须在招聘,培训,裁员(裁员)和安排工时方面做出选择。人员配备问题在制造业和服务业广泛存在。 ### What You Will Learn In this example, we will model and solve a manpower planning problem. We have three types of workers with different skills levels. For each year in the planning horizon, the forecasted number o...
github_jupyter
``` %matplotlib inline %reload_ext autoreload %autoreload 2 from ipyexperiments import * from lib.fastai.imports import * from lib.fastai.structured import * import pandas as pd import numpy as np import lightgbm as lgb from scipy.sparse import vstack, csr_matrix, save_npz, load_npz from sklearn.preprocessing import L...
github_jupyter
``` #Goal: obtain a universal time, in Julian Date from a local time in the header of the fits images from astropy.io import fits #work with fits images from astropy.time import Time #work with time in header import glob #work with files in the directory import yaml #work with yaml files import numpy as np import sys ...
github_jupyter
**This notebook is an exercise in the [Geospatial Analysis](https://www.kaggle.com/learn/geospatial-analysis) course. You can reference the tutorial at [this link](https://www.kaggle.com/alexisbcook/interactive-maps).** --- # Introduction You are an urban safety planner in Japan, and you are analyzing which areas o...
github_jupyter
# Classification with Neural Network for Yoga poses detection ## Import Dependencies ``` import numpy as np import pandas as pd import os import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.keras.utils import to_categorical from tensorflow.keras.preprocessing.image import load_img, img_to_array f...
github_jupyter
TVAE Model =========== In this guide we will go through a series of steps that will let you discover functionalities of the `TVAE` model, including how to: - Create an instance of `TVAE`. - Fit the instance to your data. - Generate synthetic versions of your data. - Use `TVAE` to anonymize PII information. - ...
github_jupyter
``` !pip install kornia import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import sys import os import torch.optim as optim import torchvision from torchvision import datasets, transforms from scipy import io import torch.utils.data import scipy from scipy.stats import entropy import...
github_jupyter
## _*H2 ground state energy computation using Iterative QPE*_ This notebook demonstrates using Qiskit Chemistry to plot graphs of the ground state energy of the Hydrogen (H2) molecule over a range of inter-atomic distances using IQPE (Iterative Quantum Phase Estimation) algorithm. It is compared to the same energies a...
github_jupyter
# ML Pipeline Preparation Follow the instructions below to help you create your ML pipeline. ### 1. Import libraries and load data from database. - Import Python libraries - Load dataset from database with [`read_sql_table`](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_sql_table.html) - Define fea...
github_jupyter
``` #using tensorflow kernel import tensorflow as tf print(tf.__version__) !pip list | grep waymo !pip list | grep torch !nvidia-smi import tensorflow.compat.v1 as tf import math import numpy as np import itertools import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.patches as pat...
github_jupyter
# Random Signals *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).* ## Auto-Power Spectral Density The (auto-) [power spectral dens...
github_jupyter
# Implementation of VGG16 > In this notebook I have implemented VGG16 on CIFAR10 dataset using Pytorch ``` #importing libraries import torch import torch.nn as nn import torch.nn.functional as F from torchvision import transforms import torch.optim as optim import tqdm import matplotlib.pyplot as plt from torchvisio...
github_jupyter
*Accompanying code examples of the book "Introduction to Artificial Neural Networks and Deep Learning: A Practical Guide with Applications in Python" by [Sebastian Raschka](https://sebastianraschka.com). All code examples are released under the [MIT license](https://github.com/rasbt/deep-learning-book/blob/master/LICEN...
github_jupyter
# REINFORCE in PyTorch Just like we did before for Q-learning, this time we'll design a PyTorch network to learn `CartPole-v0` via policy gradient (REINFORCE). Most of the code in this notebook is taken from approximate Q-learning, so you'll find it more or less familiar and even simpler. ``` import sys, os if 'goog...
github_jupyter
# Equivalent layer technique for estimating total magnetization direction: Analysis of the result ## Importing libraries ``` % matplotlib inline import sys import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab import cPickle as pickle import datetime import timeit import string as st from...
github_jupyter
# BE 240 Lecture 4 # Sub-SBML ## Modeling diffusion, shared resources, and compartmentalized systems ## _Ayush Pandey_ ``` # This notebook is designed to be converted to a HTML slide show # To do this in the command prompt type (in the folder containing the notebook): # jupyter nbconvert BE240_Lecture4_Sub-SBML.ipy...
github_jupyter
# Examples of usage of Gate Angle Placeholder The word "Placeholder" is used in Qubiter (we are in good company, Tensorflow uses this word in the same way) to mean a variable for which we delay/postpone assigning a numerical value (evaluating it) until a later time. In the case of Qubiter, it is useful to define gates...
github_jupyter
# The art of using pipelines Pipelines are a natural way to think about a machine learning system. Indeed with some practice a data scientist can visualise data "flowing" through a series of steps. The input is typically some raw data which has to be processed in some manner. The goal is to represent the data in such ...
github_jupyter
# Photometric Plugin For optical photometry, we provide the **PhotometryLike** plugin that handles forward folding of a spectral model through filter curves. Let's have a look at the avaiable procedures. ``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline from threeML import * # we will need ...
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
``` import numpy as np import pandas as pd from matplotlib import pyplot as plt from tqdm import tqdm %matplotlib inline from torch.utils.data import Dataset, DataLoader import torch import torchvision import torch.nn as nn import torch.optim as optim from torch.nn import functional as F device = torch.device("cuda" i...
github_jupyter
# Introduction to Convolutional Neural Networks (CNNs) in PyTorch ### Representing images digitally While convolutional neural networks (CNNs) see a wide variety of uses, they were originally designed for images, and CNNs are still most commonly used for vision-related tasks. For today, we'll primarily be focusing on...
github_jupyter
# Tutorial - Time Series Forecasting - Autoregression (AR) The goal is to forecast time series with the Autoregression (AR) Approach. 1) JetRail Commuter, 2) Air Passengers, 3) Function Autoregression with Air Passengers, and 5) Function Autoregression with Wine Sales. References Jason Brownlee - https://machinelearn...
github_jupyter
# Tune TensorFlow Serving ## Guidelines ### CPU-only If your system is CPU-only (no GPU), then consider the following values: * `num_batch_threads` equal to the number of CPU cores * `max_batch_size` to infinity (ie. MAX_INT) * `batch_timeout_micros` to 0. Then experiment with batch_timeout_micros values in the 1-10...
github_jupyter
## The Basics At the core of Python (and any programming language) there are some key characteristics of how a program is structured that enable the proper execution of that program. These characteristics include the structure of the code itself, the core data types from which others are built, and core operators that...
github_jupyter
# Bayesian Optimization [Bayesian optimization](https://en.wikipedia.org/wiki/Bayesian_optimization) is a powerful strategy for minimizing (or maximizing) objective functions that are costly to evaluate. It is an important component of [automated machine learning](https://en.wikipedia.org/wiki/Automated_machine_learn...
github_jupyter
# Exploratory Data Analysis In this notebook, I have illuminated some of the strategies that one can use to explore the data and gain some insights about it. We will start from finding metadata about the data, to determining what techniques to use, to getting some important insights about the data. This is based on t...
github_jupyter
``` import numpy as np import pandas as pd import scipy import matplotlib.pyplot as plt from sklearn.metrics import accuracy_score from datetime import datetime %matplotlib inline import matplotlib from datetime import datetime import os from scipy import stats from definitions import HUMAN_DATA_DIR, ROOT_DIR from dat...
github_jupyter
# UCI Daphnet dataset (Freezing of gait for Parkinson's disease patients) ``` import numpy as np import pandas as pd import os from typing import List from pathlib import Path from config import data_raw_folder, data_processed_folder from timeeval import Datasets import matplotlib import matplotlib.pyplot as plt %matp...
github_jupyter
# SDLib > Shilling simulated attacks and detection methods ## Setup ``` !mkdir -p results ``` ### Imports ``` from collections import defaultdict import numpy as np import random import os import os.path from os.path import abspath from os import makedirs,remove from re import compile,findall,split import matplotli...
github_jupyter
# Deep learning for Natural Language Processing * Simple text representations, bag of words * Word embedding and... not just another word2vec this time * 1-dimensional convolutions for text * Aggregating several data sources "the hard way" * Solving ~somewhat~ real ML problem with ~almost~ end-to-end deep learni...
github_jupyter
## Loading libraries and looking at given data ``` import numpy as np import pandas as pd import seaborn as sns import re appendix_3=pd.read_excel("Appendix_3_august.xlsx") appendix_3 print(appendix_3["Language"].value_counts(),) print(appendix_3["Country"].value_counts()) pd.set_option("display.max_rows", None, "disp...
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
<table class="ee-notebook-buttons" align="left"> <td><a target="_parent" href="https://github.com/giswqs/geemap/tree/master/tutorials/ImageCollection/01_image_collection_overview.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target=...
github_jupyter
# Regarding this Notebook This is a replication of the original analysis performed in the paper by [Waade & Enevoldsen 2020](missing). This replication script will not be updated as it is intended for reproducibility. Any deviations from the paper is marked with bold for transparency. Footnotes and internal documentati...
github_jupyter
# Building the dataset In this notebook, I'm going to be working with three datasets to create the dataset that the chatbot will be trained on. ``` import pandas as pd files_path = 'D:/Sarcastic Chatbot/Input/' ``` # First dataset **The Wordball Joke Dataset**, [link](https://www.kaggle.com/bfinan/jokes-question-and...
github_jupyter
![](../graphics/solutions-microsoft-logo-small.png) # Python for Data Professionals ## 02 Programming Basics <p style="border-bottom: 1px solid lightgrey;"></p> <dl> <dt>Course Outline</dt> <dt>1 - Overview and Course Setup</dt> <dt>2 - Programming Basics <i>(This section)</i></dt> <dd>2.1 - Getting help<...
github_jupyter
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_10_3_text_generation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # T81-558: Applications of Deep Neural Networks **Module 10: Time Serie...
github_jupyter
``` %matplotlib inline import pandas as pd from os.path import join import seaborn as sns import matplotlib.pyplot as plt import numpy as np import skbio # from q2d2 import get_within_between_distances, filter_dm_and_map from stats import mc_t_two_sample from skbio.stats.distance import anosim, permanova from skbio.sta...
github_jupyter
``` import tensorflow as tf print(tf.__version__) import numpy as np import matplotlib.pyplot as plt def plot_series(time, series, format="-", start=0, end=None): plt.plot(time[start:end], series[start:end], format) plt.xlabel("Time") plt.ylabel("Value") plt.grid(True) #!wget --no-check-certificate \ # ...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np import h5py archive = h5py.File('/Users/bmmorris/git/aesop/notebooks/spectra.hdf5', 'r+') targets = list(archive) list(archive['HD122120'])#['2017-09-11T03:27:13.140']['flux'][:] from scipy.ndimage import gaussian_filter1d spectrum1 = archive['...
github_jupyter
## Mixture Density Networks with PyTorch ## Related posts: JavaScript [implementation](http://blog.otoro.net/2015/06/14/mixture-density-networks/). TensorFlow [implementation](http://blog.otoro.net/2015/11/24/mixture-density-networks-with-tensorflow/). ``` import matplotlib.pyplot as plt import numpy as np import t...
github_jupyter
# Test For The Best Machine Learning Algorithm For Prediction This notebook takes about 40 minutes to run, but we've already run it and saved the data for you. Please read through it, though, so that you understand how we came to the conclusions we'll use moving forward. ## Six Algorithms We're going to compare six ...
github_jupyter
* 比较不同组合组合优化器在不同规模问题上的性能; * 下面的结果主要比较``alphamind``和``python``中其他优化器的性能差别,我们将尽可能使用``cvxopt``中的优化器,其次选择``scipy``; * 由于``scipy``在``ashare_ex``上面性能太差,所以一般忽略``scipy``在这个股票池上的表现; * 时间单位都是毫秒。 * 请在环境变量中设置`DB_URI`指向数据库 ``` import os import timeit import numpy as np import pandas as pd import cvxpy from alphamind.api import...
github_jupyter
# Day and Night Image Classifier --- The day/night image dataset consists of 200 RGB color images in two categories: day and night. There are equal numbers of each example: 100 day images and 100 night images. We'd like to build a classifier that can accurately label these images as day or night, and that relies on f...
github_jupyter
<a href="https://colab.research.google.com/github/Abhishekauti21/dsmp-pre-work/blob/master/practice_project.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` class test: def __init__(self,a): self.a=a def display(self): print(...
github_jupyter
# Detecting COVID-19 with Chest X Ray using PyTorch Image classification of Chest X Rays in one of three classes: Normal, Viral Pneumonia, COVID-19 Dataset from [COVID-19 Radiography Dataset](https://www.kaggle.com/tawsifurrahman/covid19-radiography-database) on Kaggle # Importing Libraries ``` from google.colab im...
github_jupyter
##### Copyright 2018 The TensorFlow Authors. [Licensed under the Apache License, Version 2.0](#scrollTo=ByZjmtFgB_Y5). ``` // #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" } // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file ...
github_jupyter
``` import numpy as np import pandas as pd import scipy as sp from scipy import sparse import nltk from nltk.corpus import stopwords from nltk.stem.porter import PorterStemmer import string import re import glob from sklearn.linear_model import LogisticRegression from sklearn.feature_extraction.text import CountVec...
github_jupyter
## LDA The graphical model representation of LDA is given blow: <img src="figures/LDA.png"> The basic idea of LDA is that documents are represented as random mixtures over latent topics, where each topic is characterized by a distribution over words. LDA assumes the following generative process for each document $\m...
github_jupyter
<a href="https://colab.research.google.com/github/100rab-S/TensorFlow-Advanced-Techniques/blob/main/C1W3_L3_CustomLayerWithActivation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Ungraded Lab: Activation in Custom Layers In this lab, we extend...
github_jupyter
# Herramientas Estadisticas # Contenido: 1.Estadistica: - Valor medio. - Mediana. - Desviacion estandar. 2.Histogramas: - Histrogramas con python. - Histogramas con numpy. - Como normalizar un histograma. 3.Distribuciones: - Como obtener una distribucion a partir...
github_jupyter
``` import tensorflow as tf from tensorflow.python.keras.utils import HDF5Matrix from tensorflow.python.keras.models import Model from tensorflow.python.keras.layers import (Input, Lambda, Conv2D, MaxPooling2D, Flatten, Dense, Dropout, Lambda, Activation, BatchNormalization,...
github_jupyter
# Implementing a Neural Network In this exercise we will develop a neural network with fully-connected layers to perform classification, and test it out on the CIFAR-10 dataset. ``` # A bit of setup import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.neural_net import TwoLayerNet %matplotlib ...
github_jupyter