text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
<a href="https://colab.research.google.com/github/towardsai/tutorials/blob/master/random-number-generator/random_number_generator_tutorial.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Random Number Generator Tutorial with Python * Tutorial: ...
github_jupyter
<a href="https://colab.research.google.com/github/daveshap/QuestionDetector/blob/main/QuestionDetector.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Compile Training Data Note: Generate the raw data with [this notebook](https://github.com/davesh...
github_jupyter
# RadiusNeighborsClassifier with MinMaxScaler This Code template is for the Classification task using a simple Radius Neighbor Classifier, with data being scaled by MinMaxScaler. It implements learning based on the number of neighbors within a fixed radius r of each training point, where r is a floating-point value sp...
github_jupyter
# 03 - Stats Review: The Most Dangerous Equation In his famous article of 2007, Howard Wainer writes about very dangerous equations: "Some equations are dangerous if you know them, and others are dangerous if you do not. The first category may pose danger because the secrets within its bounds open doors beh...
github_jupyter
# Gender Prediction, using Pre-trained Keras Model Deep Neural Networks can be used to extract features in the input and derive higher level abstractions. This technique is used regularly in vision, speech and text analysis. In this exercise, we use a pre-trained model deep learning model that would identify low level...
github_jupyter
# Carving Unit Tests So far, we have always generated _system input_, i.e. data that the program as a whole obtains via its input channels. If we are interested in testing only a small set of functions, having to go through the system can be very inefficient. This chapter introduces a technique known as _carving_, w...
github_jupyter
``` # Import Module import numpy as np import pandas as pd import matplotlib.pyplot as plt import h5py # Read data, which has a size of N * 784 and N * 1 MNIST = h5py.File("..\MNISTdata.hdf5",'r') x_train = np.float32(MNIST['x_train'][:]) x_test = np.float32(MNIST['x_test'][:]) y_train = np.int32(MNIST['y_train'][:,0])...
github_jupyter
# Attention Basics In this notebook, we look at how attention is implemented. We will focus on implementing attention in isolation from a larger model. That's because when implementing attention in a real-world model, a lot of the focus goes into piping the data and juggling the various vectors rather than the concepts...
github_jupyter
# Seasonal Accuracy Assessment of Water Observations from Space (WOfS) Product in Africa<img align="right" src="../Supplementary_data/DE_Africa_Logo_Stacked_RGB_small.jpg"> ## Description Now that we have run WOfS classification for each AEZs in Africa, its time to conduct seasonal accuracy assessment for each AEZ in ...
github_jupyter
# Residual Networks Welcome to the second assignment of this week! You will learn how to build very deep convolutional networks, using Residual Networks (ResNets). In theory, very deep networks can represent very complex functions; but in practice, they are hard to train. Residual Networks, introduced by [He et al.](h...
github_jupyter
# Siamese Neural Network with Triplet Loss trained on MNIST ## Cameron Trotter ### c.trotter2@ncl.ac.uk This notebook builds an SNN to determine similarity scores between MNIST digits using a triplet loss function. The use of class prototypes at inference time is also explored. This notebook is based heavily on the ...
github_jupyter
# Multi-class Classification and Neural Networks ## 1. Multi-class Classification In this exercise, we will use logistic regression and neural networks to recognize handwritten digits (from 0 to 9). ### 1.1 Dataset The dataset ex3data1.mat contains 5000 training examples of handwritten digits. Each training example ...
github_jupyter
``` import construction as cs import matplotlib.pyplot as plt ### read font from matplotlib import font_manager font_dirs = ['Barlow/'] font_files = font_manager.findSystemFonts(fontpaths=font_dirs) for font_file in font_files: font_manager.fontManager.addfont(font_file) # set font plt.rcParams['font.family'] =...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.ensemble import * from sklearn.linear_model import * from sklearn.model_selection import train_test_split, GridSearchCV, cross_val_predict ### UTILITY FUNCTION FOR DATA GENERATION ### def gen_sinusoidal(timesteps, amp, freq, noise...
github_jupyter
# Plotting Categorical Data In this section, we will: - Plot distributions of data across categorical variables - Plot aggregate/summary statistics across categorical variables ## Plotting Distributions Across Categories We have seen how to plot distributions of data. Often, the distributions reveal new information...
github_jupyter
# AWS Elastic Kubernetes Service (EKS) Deep MNIST In this example we will deploy a tensorflow MNIST model in Amazon Web Services' Elastic Kubernetes Service (EKS). This tutorial will break down in the following sections: 1) Train a tensorflow model to predict mnist locally 2) Containerise the tensorflow model with o...
github_jupyter
``` import sys sys.path.append('../transformers/') import tensorflow as tf import tensorflow_datasets as tfds import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import pickle from tqdm import tqdm from path_explain import utils from plot.text import text_plot, matrix_interaction_plot, bar_inte...
github_jupyter
# explore_data_gov_sg_api ## Purpose: Explore the weather-related APIs at https://developers.data.gov.sg. ## History: - 2017-05 - Benjamin S. Grandey - 2017-05-29 - Moving from atmos-scripts repository to access-data-gov-sg repository, and renaming from data_gov_sg_explore.ipynb to explore_data_gov_sg_api.ipynb. ```...
github_jupyter
Before you turn this problem in, make sure everything runs as expected. First, **restart the kernel** (in the menubar, select Kernel$\rightarrow$Restart) and then **run all cells** (in the menubar, select Cell$\rightarrow$Run All). Make sure you fill in any place that says `YOUR CODE HERE` or "YOUR ANSWER HERE", as we...
github_jupyter
This model will cluster a set of data, first with KMeans and then with MiniBatchKMeans, and plot the results. It will also plot the points that are labelled differently between the two algorithms. ``` import time import numpy as np import matplotlib.pyplot as plt from sklearn.cluster import MiniBatchKMeans, KMeans f...
github_jupyter
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-59152712-8"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-59152712-8'); </script> # `GiRaFFE_NRPy`: Source Terms ## Author: Patrick Nelson ...
github_jupyter
# Find Descriptors (Matching) Similar to classification, VDMS supports feature vector search based on similariy matching as part of its API. In this example, where we have a pre-load set of feature vectors and labels associated, we can search for similar feature vectors, and query information related to it. We will...
github_jupyter
``` !sudo nvidia-persistenced !sudo nvidia-smi -ac 877,1530 from IPython.core.display import display, HTML display(HTML("<style>.container {width:95% !important;}</style>")) from core import * from torch_backend import * colors = ColorMap() draw = lambda graph: display(DotGraph({p: ({'fillcolor': colors[type(v)], 'to...
github_jupyter
# Radius and mean slip of rock patches failing in micro-seismic events When stresses in a rock surpass its shear strength, the affected rock volume will fail to shearing. Assume that we observe a circular patch with radius $r$ on, e.g. a fault, and that this patch is affected by a slip with an average slip distance ...
github_jupyter
# Color extraction from images with Lithops4Ray In this tutorial we explain how to use Lithops4Ray to extract colors and [HSV](https://en.wikipedia.org/wiki/HSL_and_HSV) color range from the images persisted in the IBM Cloud Oject Storage. To experiment with this tutorial, you can use any public image dataset and uplo...
github_jupyter
# Introduction to Deep Learning with PyTorch In this notebook, you'll get introduced to [PyTorch](http://pytorch.org/), a framework for building and training neural networks. PyTorch in a lot of ways behaves like the arrays you love from Numpy. These Numpy arrays, after all, are just tensors. PyTorch takes these tenso...
github_jupyter
``` import nltk import re import operator from collections import defaultdict import numpy as np import matplotlib.pyplot as plt ``` The idea is generate more common sentences according to their word tagging. So the sentences will have the real structure written by lovecraft and composed by a list of most common word...
github_jupyter
# Tutorial - Evaluate DNBs additional Rules This notebook contains a tutorial for the evaluation of DNBs additional Rules for the following Solvency II reports: - Annual Reporting Solo (ARS); and - Quarterly Reporting Solo (QRS) Besides the necessary preparation, the tutorial consists of 6 steps: 1. Read possible dat...
github_jupyter
# SST-2 # Simple Baselines using ``mean`` and ``last`` pooling ## Librairies ``` # !pip install transformers==4.8.2 # !pip install datasets==1.7.0 # !pip install ax-platform==0.1.20 import os import sys sys.path.insert(0, os.path.abspath("../..")) # comment this if library is pip installed import io import re import ...
github_jupyter
``` %run ./dlt %run ./dlt_workflow_refactored from pyspark.sql import Row import unittest from pyspark.sql.functions import lit import datetime timestamp = datetime.datetime.fromisoformat("2000-01-01T00:00:00") def timestamp_provider(): return lit(timestamp) from pyspark.sql.functions import when, col from pyspar...
github_jupyter
# T1056.004 - Input Capture: Credential API Hooking Adversaries may hook into Windows application programming interface (API) functions to collect user credentials. Malicious hooking mechanisms may capture API calls that include parameters that reveal user authentication credentials.(Citation: Microsoft TrojanSpy:Win32...
github_jupyter
``` #from lab2.utils import get_random_number_generator class BoxWindow: """[summary]""" def __init__(self, args): """initialize the box window with the bounding points Args: args (np.array([integer])): array of the bounding points of the box """ self.bounds = arg...
github_jupyter
# Introduction to Data Science ## From correlation to supervised segmentation and tree-structured models Spring 2018 - Profs. Foster Provost and Josh Attenberg Teaching Assistant: Apostolos Filippas *** ### Some general imports ``` import os import numpy as np import pandas as pd import math import matplotlib.pyl...
github_jupyter
This notebook was prepared by [Donne Martin](http://donnemartin.com). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges). # Challenge Notebook ## Problem: Find the kth to last element of a linked list. * [Constraints](#Constraints) * [Test Cases](#Test-Cases) * [Algo...
github_jupyter
## Distinction of solid liquid atoms and clustering In this example, we will take one snapshot from a molecular dynamics simulation which has a solid cluster in liquid. The task is to identify solid atoms and cluster them. More details about the method can be found [here](https://pyscal.readthedocs.io/en/latest/solidl...
github_jupyter
## Download the Fashion-MNIST dataset ``` import os import numpy as np from tensorflow.keras.datasets import fashion_mnist (x_train, y_train), (x_val, y_val) = fashion_mnist.load_data() os.makedirs("./data", exist_ok = True) np.savez('./data/training', image=x_train, label=y_train) np.savez('./data/validation', imag...
github_jupyter
``` import mackinac import cobra import pandas as pd import json import os import numpy as np # load ID's for each organisms genome id_table = pd.read_table('../data/study_strain_subset_w_patric.tsv',sep='\t',dtype=str) id_table = id_table.replace(np.nan, '', regex=True) species_to_id = dict(zip(id_table["designation i...
github_jupyter
This script loads behavioral mice data (from `biasedChoiceWorld` protocol and, separately, the last three sessions of training) only from mice that pass a given (stricter) training criterion. For the `biasedChoiceWorld` protocol, only sessions achieving the `trained_1b` and `ready4ephysrig` training status are collecte...
github_jupyter
<h1>CI Midterm<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Q1-Simple-Linear-Regression" data-toc-modified-id="Q1-Simple-Linear-Regression-1">Q1 Simple Linear Regression</a></span></li><li><span><a href="#Q2-Fuzzy-Linear-Regression" data-toc-modified-id="Q2-Fuzzy-Linear-Re...
github_jupyter
``` # fetching data online import os import tarfile from six.moves import urllib DOWNLOAD_ROOT = "https://raw.githubusercontent.com/ageron/handson-ml2/master/" HOUSING_PATH = os.path.join("datasets", "housing") HOUSING_URL = DOWNLOAD_ROOT + "datasets/housing/housing.tgz" def fetch_housing_data(housing_url=HOUSING_URL,...
github_jupyter
# 2016 Olympics medal count acquisition In this notebook, we acquire the current medal count from the web. # 1. List of sports ``` from bs4 import BeautifulSoup import urllib r = urllib.urlopen('http://www.bbc.com/sport/olympics/rio-2016/medals/sports').read() soup = BeautifulSoup(r,"lxml") sports_span = soup.findA...
github_jupyter
``` import torch from torch.nn import functional as F from torch import nn from pytorch_lightning.core.lightning import LightningModule import pytorch_lightning as pl import torch.optim as optim import torchvision import torchvision.datasets as datasets import torchvision.transforms as transforms from torch.utils.data...
github_jupyter
**Chapter 7 – Ensemble Learning and Random Forests** _This notebook contains all the sample code and solutions to the exercises in chapter 7._ <table align="left"> <td> <a target="_blank" href="https://colab.research.google.com/github/ageron/handson-ml2/blob/master/07_ensemble_learning_and_random_forests.ipynb"...
github_jupyter
# Using [vtreat](https://github.com/WinVector/pyvtreat) with Classification Problems Nina Zumel and John Mount November 2019 Note: this is a description of the [`Python` version of `vtreat`](https://github.com/WinVector/pyvtreat), the same example for the [`R` version of `vtreat`](https://github.com/WinVector/vtreat)...
github_jupyter
``` # Copyright 2019 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 writi...
github_jupyter
# Hypothesis Testing ``` set.seed(37) ``` ## Student's t-test The `Student's t-test` compares the means of two samples to see if they are different. Here is a `two-sided` Student's t-test. ``` x <- rnorm(1000, mean=0, sd=1) y <- rnorm(1000, mean=1, sd=1) r <- t.test(x, y, alternative='two.sided') print(r) ``` Her...
github_jupyter
``` !pip install confluent-kafka==1.7.0 from confluent_kafka.admin import AdminClient, NewTopic, NewPartitions from confluent_kafka import KafkaException import sys from uuid import uuid4 bootstrap_server = "kafka:9092" # Brokers act as cluster entripoints conf = {'bootstrap.servers': bootstrap_server} a = AdminClient(...
github_jupyter
``` #default_exp dispatch #export from fastcore.imports import * from fastcore.foundation import * from fastcore.utils import * from nbdev.showdoc import * from fastcore.test import * ``` # Type dispatch > Basic single and dual parameter dispatch ## Helpers ``` #exports def type_hints(f): "Same as `typing.get_t...
github_jupyter
# Scalars ``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt ``` ## Integers ### Binary representation of integers ``` format(16, '032b') ``` ### Bit shifting ``` format(16 >> 2, '032b') 16 >> 2 format(16 << 2, '032b') 16 << 2 ``` ### Overflow In general, the computer representation of in...
github_jupyter
#Introduction to the Research Environment The research environment is powered by IPython notebooks, which allow one to perform a great deal of data analysis and statistical validation. We'll demonstrate a few simple techniques here. ##Code Cells vs. Text Cells As you can see, each cell can be either code or text. To...
github_jupyter
## GMLS-Nets: 1D Regression of Linear and Non-linear Operators $L[u]$. __Ben J. Gross__, __Paul J. Atzberger__ <br> http://atzberger.org/ Examples showing how GMLS-Nets can be used to perform regression for some basic linear and non-linear differential operators in 1D. __Parameters:__</span> <br> The key parameter...
github_jupyter
``` from moviepy.editor import * postedByFontSize=25 replyFontSize=35 titleFontSize=100 cortinilla= VideoFileClip('assets for Channel/assets for video/transicion.mp4') clip = ImageClip('assets for Channel/assets for video/background assets/fondo_preguntas.jpg').on_color((1920, 1080)) final= VideoFileClip('assets for C...
github_jupyter
# PoissonRegressor with StandardScaler & Power Transformer This Code template is for the regression analysis using Poisson Regressor, StandardScaler as feature rescaling technique and Power Transformer as transformer in a pipeline. This is a generalized Linear Model with a Poisson distribution. ### Required Packages ...
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
# This notebook helps you to do several things: 1) Find your optimal learning rate https://docs.fast.ai/callbacks.html#LRFinder 2) ``` %reload_ext autoreload %autoreload 2 import fastai from fastai.callbacks import * from torch.utils.data import Dataset, DataLoader from models import UNet2d_assembled import numpy as...
github_jupyter
## Sampling You can get a randomly rows of the dataset. It is very usefull in training machine learning models. We will use the dataset about movie reviewers obtained of [here](http://grouplens.org/datasets/movielens/100k/). ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt # read a dataset o...
github_jupyter
# Plots of the total distance covered by the particles as a function of their initial position *Author: Miriam Sterl* We plot the total distances covered by the particles during the simulation, as a function of their initial position. We do this for the FES, the GC and the GC+FES run. ``` from netCDF4 import Dataset...
github_jupyter
# Data-Sitters Club 8: Just the Code This notebook contains just the code (and a little bit of text) from the portions of *[DSC 8: Text-Comparison-Algorithm-Crazy-Quinn](https://datasittersclub.github.io/site/dsc8/)* for using Euclidean and cosine distance with word counts and word frequencies, and running TF-IDF for ...
github_jupyter
# Politician Activity on Facebook by Political Affiliation The parameters in the cell below can be adjusted to explore other political affiliations and time frames. ### How to explore other political affiliation? The ***affiliation*** parameter can be use to aggregate politicians by their political affiliations. The ...
github_jupyter
# 目的:了解Python基本語法 1. [資料型別](#01) 2. [for-loop](#02) 3. [while-loop](#03) 4. [清單(list)](#04) 5. [tuple是什麼?](#05) 6. [Python特殊的清單處理方式](#06) 7. [if的用法](#07) 8. [以if控制迴圈的break和continue](#08) 9. [函數:將計算結果直接於函數內印出或回傳(return)出函數外](#09) 10. [匿名函數](#10) 11. [物件導向範例](#11) 12. [NumPy (Python中用於處理numerical array的套件)](#12) 13. [一維...
github_jupyter
# SageMaker Batch Transform using an XgBoost Bring Your Own Container (BYOC) In this notebook, we will walk through an end to end data science workflow demonstrating how to build your own custom XGBoost Container using Amazon SageMaker Studio. We will first process the data using SageMaker Processing, push an XGB algo...
github_jupyter
# Operations on word vectors Welcome to your first assignment of this week! Because word embeddings are very computionally expensive to train, most ML practitioners will load a pre-trained set of embeddings. **After this assignment you will be able to:** - Load pre-trained word vectors, and measure similarity usi...
github_jupyter
# 16 - Regression Discontinuity Design We don't stop to think about it much, but it is impressive how smooth nature is. You can't grow a tree without first getting a bud, you can't teleport from one place to another, a wound takes its time to heal. Even in the social realm, smoothness seems to be the norm. You can't ...
github_jupyter
``` # Import libraries and modules import matplotlib.pyplot as plt import numpy as np import os import tensorflow as tf print(np.__version__) print(tf.__version__) np.set_printoptions(threshold=np.inf) ``` # Local Development ## Arguments ``` arguments = {} # File arguments. arguments["train_file_pattern"] = "gs://m...
github_jupyter
# Tidy Data > Structuring datasets to facilitate analysis [(Wickham 2014)](http://www.jstatsoft.org/v59/i10/paper) If there's one maxim I can impart it's that your tools shouldn't get in the way of your analysis. Your problem is already difficult enough, don't let the data or your tools make it any harder. ## The Ru...
github_jupyter
# Module 3 Graded Assessment ``` """ 1.Question 1 Fill in the blanks of this code to print out the numbers 1 through 7. """ number = 1 while number <= 7: print(number, end=" ") number +=1 """ 2.Question 2 The show_letters function should print out each letter of a word on a separate line. Fill in the blanks to mak...
github_jupyter
### Instructions The lecture uses random forest to predict the state of the loan with data taken from Lending Club (2015). With minimal feature engineering, they were able to get an accuracy of 98% with cross validation. However, the accuracies had a lot of variance, ranging from 98% to 86%, indicating there are lots ...
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
論文<br> https://arxiv.org/abs/2109.07161<br> <br> GitHub<br> https://github.com/saic-mdal/lama<br> <br> <a href="https://colab.research.google.com/github/kaz12tech/ai_demos/blob/master/Lama_demo.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # 環境セットア...
github_jupyter
``` # assume you have openmm, pdbfixer and mdtraj installed. # if not, you can follow the gudie here https://github.com/npschafer/openawsem # import all using lines below # from simtk.openmm.app import * # from simtk.openmm import * # from simtk.unit import * from simtk.openmm.app import ForceField # define atoms and ...
github_jupyter
# [NTDS'18] tutorial 2: build a graph from an edge list [ntds'18]: https://github.com/mdeff/ntds_2018 [Benjamin Ricaud](https://people.epfl.ch/benjamin.ricaud), [EPFL LTS2](https://lts2.epfl.ch) * Dataset: [Open Tree of Life](https://tree.opentreeoflife.org) * Tools: [pandas](https://pandas.pydata.org), [numpy](http:...
github_jupyter
<a href="https://colab.research.google.com/github/livjab/DS-Unit-2-Sprint-4-Practicing-Understanding/blob/master/module1-hyperparameter-optimization/LS_DS_241_Hyperparameter_Optimization.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> _Lambda School...
github_jupyter
``` import fitsio as ft import healpy as hp import numpy as np import matplotlib.pyplot as plt import sys sys.path.append('/users/PHS0336/medirz90/github/LSSutils') from lssutils.utils import make_hp from lssutils.lab import get_cl from lssutils.extrn.galactic.hpmaps import logHI from sklearn.linear_model import Linea...
github_jupyter
# Scroll down to get to the interesting tables... # Construct list of properties of widgets "Properties" here is one of: + `keys` + `traits()` + `class_own_traits()` Common (i.e. uninteresting) properties are filtered out. The dependency on astropy is for their Table. Replace it with pandas if you want... ``` imp...
github_jupyter
# DJL BERT Inference Demo ## Introduction In this tutorial, you walk through running inference using DJL on a [BERT](https://towardsdatascience.com/bert-explained-state-of-the-art-language-model-for-nlp-f8b21a9b6270) QA model trained with MXNet and PyTorch. You can provide a question and a paragraph containing the a...
github_jupyter
# Feature Engineering in Keras. Let's start off with the Python imports that we need. ``` import os, json, math, shutil import numpy as np import tensorflow as tf print(tf.__version__) # Note that this cell is special. It's got a tag (you can view tags by clicking on the wrench icon on the left menu in Jupyter) # The...
github_jupyter
``` import os, numpy, warnings import pandas as pd os.environ['R_HOME'] = '/home/gdpoore/anaconda3/envs/tcgaAnalysisPythonR/lib/R' warnings.filterwarnings('ignore') %config InlineBackend.figure_format = 'retina' %reload_ext rpy2.ipython %%R require(ggplot2) require(snm) require(limma) require(edgeR) require(dplyr) req...
github_jupyter
![alt text](https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTK4gQ9nhwHHaSXMHpeggWg7twwMCgb877smkRmtkmDeDoGF9Z6&usqp=CAU) # <font color='Blue'> Ciência dos Dados na Prática</font> # Sistemas de Recomendação ![](https://img.icons8.com/emoji/452/books-emoji.png) Cada empresa de consumo de Internet precisa um si...
github_jupyter
# Transporter statistics and taxonomic profiles ## Overview In this notebook some overview statistics of the datasets are computed and taxonomic profiles investigated. The notebook uses data produced by running the [01.process_data](01.process_data.ipynb) notebook. ``` import numpy as np import pandas as pd import s...
github_jupyter
``` import numpy as np from keras.models import Sequential from keras.models import load_model from keras.models import model_from_json from keras.layers.core import Dense, Activation from keras.utils import np_utils from keras.preprocessing.image import load_img, save_img, img_to_array from keras.applications.imagen...
github_jupyter
## Prepare data ``` # mount google drive & set working directory # requires auth (click on url & copy token into text box when prompted) from google.colab import drive drive.mount("/content/gdrive", force_remount=True) import os print(os.getcwd()) os.chdir('/content/gdrive/My Drive/Colab Notebooks/MidcurveNN') !pwd ...
github_jupyter
``` import io import os import pandas as pd data_path = 'E:\\BaiduYunDownload\\optiondata3\\' ``` ## Definitions * Underlying The stock, index, or ETF symbol * Underlying_last The last traded price at the time of the option quote. * Exchange The exchange of the quote – Asterisk(*) represents a consolidated price of al...
github_jupyter
# Modeling Transmission Line Properties ## Table of Contents * [Introduction](#introduction) * [Propagation constant](#propagation_constant) * [Interlude on attenuation units](#attenuation_units) * [Modeling a loaded lossy transmission line using transmission line functions](#tline_functions) * [Input impedances, re...
github_jupyter
# Ridge Regression ## Goal Given a dataset with continuous inputs and corresponding outputs, the objective is to find a function that matches the two as accurately as possible. This function is usually called the target function. In the case of a ridge regression, the idea is to modellize the target function as a li...
github_jupyter
``` import numpy as np import pandas as pd import os for dirname, _, filenames in os.walk('/kaggle/input'): for filename in filenames: print(os.path.join(dirname, filename)) train = pd.read_csv("/kaggle/input/30-days-of-ml/train.csv") test = pd.read_csv("/kaggle/input/30-days-of-ml/test.csv") sample_submi...
github_jupyter
``` %matplotlib inline ``` GroupLasso for linear regression with dummy variables ===================================================== A sample script for group lasso with dummy variables Setup ----- ``` import matplotlib.pyplot as plt import numpy as np from sklearn.linear_model import Ridge from sklearn.metrics ...
github_jupyter
``` %load_ext autoreload %autoreload 2 %matplotlib inline import sys import shutil sys.path.append('../code/') sys.path.append('../python/') from pprint import pprint from os import path import scipy import os from matplotlib import pyplot as plt from tqdm import tqdm from argparse import Namespace import pickle impor...
github_jupyter
# Pair-wise Correlations The purpose is to identify predictor variables strongly correlated with the sales price and with each other to get an idea of what variables could be good predictors and potential issues with collinearity. Furthermore, Box-Cox transformations and linear combinations of variables are added whe...
github_jupyter
# This notebook shows an example where a set of electrodes are selected from a dataset and then LFP is extracted from those electrodes and then written to a new NWB file ``` import pynwb import os #DataJoint and DataJoint schema import datajoint as dj ## We also import a bunch of tables so that we can call them easi...
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
# Introduction to TensorFlow v2 : Basics ### Importing and printing the versions ``` import tensorflow as tf print("TensorFlow version: {}".format(tf.__version__)) print("Eager execution is: {}".format(tf.executing_eagerly())) print("Keras version: {}".format(tf.keras.__version__)) ``` ### TensorFlow Variables [Te...
github_jupyter
``` %reload_ext autoreload %autoreload 2 import sys import os BASE_DIR = os.path.abspath(os.path.join(os.path.dirname("__file__"), os.path.pardir)) sys.path.append(BASE_DIR) import cv2 import time import numpy as np import matplotlib.pyplot as plt import imgaug as ia import imgaug.augmenters as iaa import tensorflow as...
github_jupyter
# Statistics & Data Analysis ## Req #### Import Requirements ##### HTML formatting ``` from IPython.display import HTML HTML("""<style type="text/css"> table.dataframe td, table.dataframe th { max-width: none; </style> """) HTML("""<style type="text/css"> table.dataframe td, table.dataframe th { m...
github_jupyter
``` import os import numpy as np import tensorflow as tf from tensorflow.python.keras.datasets import mnist from tensorflow.contrib.eager.python import tfe # enable eager mode tf.enable_eager_execution() tf.set_random_seed(0) np.random.seed(0) if not os.path.exists('weights/'): os.makedirs('weights/') # constants...
github_jupyter
# ANCOM: WGS ``` library(tidyverse) library(magrittr) source("/Users/Cayla/ANCOM/scripts/ancom_v2.1.R") ``` ## T2 ``` t2 <- read_csv('https://github.com/bryansho/PCOS_WGS_16S_metabolome/raw/master/DESEQ2/WGS/T2/T2_filtered_greater_00001.csv') head(t2,n=1) t2.meta <- read_csv('https://github.com/bryansho/PCOS_WGS_16S...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"></ul></div> ``` !pip install tensorflow-addons !pip install lifelines !pip install scikit-plot import tensorflow as tf import tensorflow_addons as tfa from tensorflow import keras from sklearn.model_selection import train_te...
github_jupyter
# TensorFlow BYOM: Train with Custom Training Script, Compile with Neo, and Deploy on SageMaker In this notebook you will compile a trained model using Amazon SageMaker Neo. This notebook is similar to the [TensorFlow MNIST training and serving notebook](https://github.com/aws/amazon-sagemaker-examples/blob/master/sag...
github_jupyter
# $$User\ Defined\ Metrics\ Tutorial$$ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/catboost/tutorials/blob/master/custom_loss/custom_loss_and_metric_tutorial.ipynb) # Contents * [1. Introduction](#1.\-Introduction) * [2. Classification](#2.\-Cl...
github_jupyter
[Table of Contents](./table_of_contents.ipynb) # The Extended Kalman Filter ``` from __future__ import division, print_function %matplotlib inline #format the book import book_format book_format.set_style() ``` We have developed the theory for the linear Kalman filter. Then, in the last two chapters we broached the ...
github_jupyter
``` import os import sys import random import math import re import time import numpy as np import cv2 import matplotlib import matplotlib.pyplot as plt # Root directory of the project ROOT_DIR = os.getenv("MRCNN_HOME", "/Mask_RCNN") # Import Mask RCNN sys.path.append(ROOT_DIR) # To find local version of the library...
github_jupyter