text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# SLU09 - Classification With Logistic Regression: Exercise notebook ``` import pandas as pd import numpy as np import hashlib ``` In this notebook you will practice the following: - What classification is for - Logistic regression - Cost function - Binary classification You thought that you ...
github_jupyter
# Baby boy/girl classifier model preparation *based on: Francisco Ingham and Jeremy Howard. Inspired by [Adrian Rosebrock](https://www.pyimagesearch.com/2017/12/04/how-to-create-a-deep-learning-dataset-using-google-images/)* *by: Artyom Vorobyov* Notebook execution and model training is made in Google Colab ``` fro...
github_jupyter
``` import torch import datasets as nlp from transformers import LongformerTokenizerFast tokenizer = LongformerTokenizerFast.from_pretrained('allenai/longformer-base-4096') def get_correct_alignement(context, answer): """ Some original examples in SQuAD have indices wrong by 1 or 2 character. We test and fix this h...
github_jupyter
``` from IPython.display import Markdown as md ### change to reflect your notebook _nb_loc = "09_deploying/09c_changesig.ipynb" _nb_title = "Changing signatures of exported model" ### no need to change any of this _nb_safeloc = _nb_loc.replace('/', '%2F') md(""" <table class="tfo-notebook-buttons" align="left"> <td...
github_jupyter
<a href="https://colab.research.google.com/github/Miseq/naive_imdb_reviews_model/blob/master/naive_imdb_model.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` from keras.datasets import imdb from keras import optimizers from keras import losses f...
github_jupyter
# Convolutional Neural Networks: Application Welcome to Course 4's second assignment! In this notebook, you will: - Implement helper functions that you will use when implementing a TensorFlow model - Implement a fully functioning ConvNet using TensorFlow **After this assignment you will be able to:** - Build and t...
github_jupyter
### Deep Kung-Fu with advantage actor-critic In this notebook you'll build a deep reinforcement learning agent for atari [KungFuMaster](https://gym.openai.com/envs/KungFuMaster-v0/) and train it with advantage actor-critic. ![http://www.retroland.com/wp-content/uploads/2011/07/King-Fu-Master.jpg](http://www.retroland...
github_jupyter
# Project 3: Smart Beta Portfolio and Portfolio Optimization ## Overview Smart beta has a broad meaning, but we can say in practice that when we use the universe of stocks from an index, and then apply some weighting scheme other than market cap weighting, it can be considered a type of smart beta fund. By contrast,...
github_jupyter
# 作業 : (Kaggle)鐵達尼生存預測 https://www.kaggle.com/c/titanic # [作業目標] - 試著調整特徵篩選的門檻值, 觀察會有什麼影響效果 # [作業重點] - 調整相關係數過濾法的篩選門檻, 看看篩選結果的影響 (In[5]~In[8], Out[5]~Out[8]) - 調整L1 嵌入法篩選門檻, 看看篩選結果的影響 (In[9]~In[11], Out[9]~Out[11]) ``` # 做完特徵工程前的所有準備 (與前範例相同) import pandas as pd import numpy as np import copy from sklearn.preprocess...
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> # Convert LaTeX Sentence to SymPy Expression ## Author: Ke...
github_jupyter
# Analyzing data with Pandas First a little setup. Importing the pandas library as ```pd``` ``` import pandas as pd ``` Set some helpful display options. Uncomment the boilerplate in this cell. ``` %matplotlib inline pd.set_option("max_columns", 150) pd.set_option('max_colwidth',40) pd.options.display.float_format ...
github_jupyter
``` library(caret, quiet=TRUE); library(base64enc) library(httr, quiet=TRUE) ``` # Build a Model ``` set.seed(1960) create_model = function() { model <- train(Species ~ ., data = iris, method = "ctree2") return(model) } # dataset model = create_model() # pred <- predict(model, as.matrix(iris[, -5]) ...
github_jupyter
# Predicting NYC Taxi Fares with RAPIDS Process 380 million rides in NYC from 2015-2017. RAPIDS is a suite of GPU accelerated data science libraries with APIs that should be familiar to users of Pandas, Dask, and Scikitlearn. This notebook focuses on showing how to use cuDF with Dask & XGBoost to scale GPU DataFrame ...
github_jupyter
``` #importing modules import os import codecs import numpy as np import string import pandas as pd ``` # **Data Preprocessing** ``` #downloading and extracting the files on colab server import urllib.request urllib.request.urlretrieve ("https://archive.ics.uci.edu/ml/machine-learning-databases/20newsgroups-mld/20_ne...
github_jupyter
``` ``` # INTRODUCTION TO UNSUPERVISED LEARNING Unsupervised learning is the training of a machine using information that is neither classified nor labeled and allowing the algorithm to act on that information without guidance. Here the task of the machine is to group unsorted information according to similarit...
github_jupyter
``` %load_ext rpy2.ipython %matplotlib inline from fbprophet import Prophet import pandas as pd from matplotlib import pyplot as plt import logging logging.getLogger('fbprophet').setLevel(logging.ERROR) import warnings warnings.filterwarnings("ignore") df = pd.read_csv('../examples/example_wp_log_peyton_manning.csv') m...
github_jupyter
### Demonstration of `flopy.utils.get_transmissivities` method for computing open interval transmissivities (for weighted averages of heads or fluxes) In practice this method might be used to: * compute vertically-averaged head target values representative of observation wells of varying open intervals (including va...
github_jupyter
``` import pandas as pd import warnings warnings.filterwarnings('ignore') # Dependencies for interaction with database: from sqlalchemy import create_engine from sqlalchemy.orm import Session # Machine Learning dependencies: from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import StandardSca...
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 math import numpy as np import pandas as pd ``` ### Initial conditions ``` initial_rating = 400 k = 100 things = ['Malted Milk','Rich Tea','Hobnob','Digestive'] ``` ### Elo Algos ``` def expected_win(r1, r2): """ Expected probability of player 1 beating player 2 if player 1 has rating 1 (r1)...
github_jupyter
# Benchmark FRESA.CAD BSWIMS final Script This algorithm implementation uses R code and a Python library (rpy2) to connect with it, in order to run the following it is necesary to have installed both on your computer: - R (you can download in https://www.r-project.org/) <br> - install rpy2 by <code> pip install rpy2...
github_jupyter
This notebook contains an implementation of the third place result in the Rossman Kaggle competition as detailed in Guo/Berkhahn's [Entity Embeddings of Categorical Variables](https://arxiv.org/abs/1604.06737). The motivation behind exploring this architecture is it's relevance to real-world application. Much of our f...
github_jupyter
<a href="https://colab.research.google.com/github/sokrypton/ColabFold/blob/main/verbose/alphafold_noTemplates_noMD.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #AlphaFold ``` ################# # WARNING ################# # - This notebook is in...
github_jupyter
# mlrose Tutorial Examples - Genevieve Hayes ## Overview mlrose is a Python package for applying some of the most common randomized optimization and search algorithms to a range of different optimization problems, over both discrete- and continuous-valued parameter spaces. This notebook contains the examples used in ...
github_jupyter
<!--NAVIGATION--> _______________ Este documento puede ser utilizado de forma interactiva en las siguientes plataformas: - [Google Colab](https://colab.research.google.com/github/masdeseiscaracteres/ml_course/blob/master/material/05_random_forests.ipynb) - [MyBinder](https://mybinder.org/v2/gh/masdeseiscaracteres/ml...
github_jupyter
``` import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec % matplotlib inline ``` ### Loading Training Transactions Data ``` tr_tr = pd.read_csv('data/train_transaction.csv', index_col='TransactionID') print('Rows :', tr_tr.shape[0],' Columns : ',tr_tr.shape...
github_jupyter
``` midifile = 'data/chopin-fantaisie.mid' import time import copy import subprocess from abc import abstractmethod import numpy as np import midi # Midi file parser from midipattern import MidiPattern from distorter import * from align import align_frame_to_frame, read_align, write_align MidiPattern.MIDI_DEVICE = 2 ...
github_jupyter
# SciPy를 이용한 최적화 - fun: 2.0 hess_inv: array([[ 0.5]]) jac: array([ 0.]) message: 'Optimization terminated successfully.' nfev: 9 # SciPy는 Sympy가 아니라서, Symbolic을 활용하지 못하기에 수치 미분을 함 - 1위치에서 3번 계산됨 nit가 2 이라는거는 2번 뛰엇나느 것이며, 3곳에서 9번함수를돌림.. nit: 2 njev: 3 status: 0 success: True x: ...
github_jupyter
# RadarCOVID-Report ## Data Extraction ``` import datetime import json import logging import os import shutil import tempfile import textwrap import uuid import matplotlib.pyplot as plt import matplotlib.ticker import numpy as np import pandas as pd import pycountry import retry import seaborn as sns %matplotlib in...
github_jupyter
``` import numpy as np import pandas as pd from matplotlib import pyplot as plt import math as m %matplotlib inline import torch import torchvision import torchvision.transforms as transforms import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import random from torch.utils.data import...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/reinforcement-learning/minecraft-on-distributed-compute/minecraft.png) # Reinforcement Learning in A...
github_jupyter
``` import csv import tensorflow as tf import numpy as np from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences !wget --no-check-certificate \ https://storage.googleapis.com/laurencemoroney-blog.appspot.com/bbc-text.csv \ -O /tmp/bbc-text.cs...
github_jupyter
# Learning Tree-augmented Naive Bayes (TAN) Structure from Data In this notebook, we show an example for learning the structure of a Bayesian Network using the TAN algorithm. We will first build a model to generate some data and then attempt to learn the model's graph structure back from the generated data. For comp...
github_jupyter
**This notebook is an exercise in the [Intermediate Machine Learning](https://www.kaggle.com/learn/intermediate-machine-learning) course. You can reference the tutorial at [this link](https://www.kaggle.com/alexisbcook/introduction).** --- As a warm-up, you'll review some machine learning fundamentals and submit you...
github_jupyter
<a href="https://colab.research.google.com/github/magenta/ddsp/blob/master/ddsp/colab/demos/timbre_transfer.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ##### Copyright 2020 Google LLC. Licensed under the Apache License, Version 2.0 (the "Licens...
github_jupyter
``` import numpy as np import copy from sklearn import preprocessing import tensorflow as tf from tensorflow import keras import os import pandas as pd from matplotlib import pyplot as plt from numpy.random import seed np.random.seed(2095) data = pd.read_excel('Dataset/CardiacPrediction.xlsx') data.drop(['SEQN','Annual...
github_jupyter
# Importing libraries ``` import nltk import glob import os import numpy as np import string import pickle from gensim.models import Doc2Vec from gensim.models.doc2vec import LabeledSentence from tqdm import tqdm from sklearn import utils from sklearn.svm import LinearSVC from sklearn.neural_network import MLPClassifi...
github_jupyter
# Lab 2: Object-Oriented Python ## Overview After have covered rules, definitions, and semantics, we'll be playing around with actual classes, writing a fair chunk of code and building several classes to solve a variety of problems. Recall our starting definitions: - An *object* has identity - A *name* is a referen...
github_jupyter
## KITTI Object Detection finetuning ### This notebook is used to lunch the finetuning of FPN on KITTI object detection benchmark, the code fetches COCO weights for weight initialization ``` data_path = "../datasets/KITTI/data_object_image_2/training" import detectron2 from detectron2.utils.logger import setup_logger ...
github_jupyter
# SP LIME ## Regression explainer with boston housing prices dataset ``` from sklearn.datasets import load_boston import sklearn.ensemble import sklearn.linear_model import sklearn.model_selection import numpy as np from sklearn.metrics import r2_score np.random.seed(1) #load example dataset boston = load_boston() ...
github_jupyter
# Practice: Basic Statistics I: Averages For this practice, let's use the Boston dataset. ``` # Import the numpy package so that we can use the method mean to calculate averages import numpy as np # Import the load_boston method from sklearn.datasets import load_boston # Import pandas, so that we can work with the d...
github_jupyter
# 第2章 スカラー移流方程式(数値計算法の基礎) ## 2.2 [3] 空間微分項に対する1次精度風上差分の利用 ``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline ``` (1) $\Delta t = 0.05, \Delta x = 0.1$ 初期化 ``` c = 1 dt = 0.05 dx = 0.1 jmax = 21 nmax = 6 x = np.linspace(0, dx * (jmax - 1), jmax) q = np.zeros(jmax) for j in range(jmax): ...
github_jupyter
``` from functools import wraps import time def show_args(function): @wraps(function) def wrapper(*args, **kwargs): print('hi from decorator - args:') print(args) result = function(*args, **kwargs) print('hi again from decorator - kwargs:') print(kwargs) retu...
github_jupyter
<a href="https://colab.research.google.com/github/yukinaga/object_detection/blob/main/section_3/03_exercise.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # 演習 RetinaNetで、物体の領域を出力する`regression_head`も訓練対象に加えてみましょう。 モデルを構築するコードに、追記を行なってください。 ## 各設...
github_jupyter
### Лекция 7. Исключения https://en.cppreference.com/w/cpp/language/exceptions https://en.cppreference.com/w/cpp/error https://apprize.info/c/professional/13.html <br /> ##### Зачем нужны исключения Для обработки исключительных ситуаций. Как вариант - обработка ошибок. <br /> ###### Как пользоваться исключения...
github_jupyter
``` import numpy as np from sklearn.datasets import load_iris # Loading the dataset iris = load_iris() X_raw = iris['data'] y_raw = iris['target'] # Isolate our examples for our labeled dataset. n_labeled_examples = X_raw.shape[0] training_indices = np.random.randint(low=0, high=len(X_raw)+1, size=3) # Defining the ...
github_jupyter
``` import pandas as pd import numpy as np import os from sklearn.metrics import mean_squared_error, mean_absolute_error import matplotlib.pyplot as plt import pickle import random import train from model import NNModelEx pd.set_option('display.max_columns', 999) # For this model, the data preprocessing part is alread...
github_jupyter
``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline credit_df = pd.read_csv('German Credit Data.csv') credit_df credit_df.info() X_features = list(credit_df.columns) X_features.remove('status') X_features encoded_df = pd.get_dummies(credit_df[X_features],d...
github_jupyter
# Comparing Training and Test and Parking and Sensor Datasets ``` import sys import pandas as pd import numpy as np import datetime as dt import time import matplotlib.pyplot as plt sys.path.append('../') from common import reorder_street_block, process_sensor_dataframe, get_train, \ feat_eng, add_...
github_jupyter
This notebook is part of the $\omega radlib$ documentation: https://docs.wradlib.org. Copyright (c) $\omega radlib$ developers. Distributed under the MIT License. See LICENSE.txt for more info. # Export a dataset in GIS-compatible format In this notebook, we demonstrate how to export a gridded dataset in GeoTIFF and...
github_jupyter
# FAO Economic and Employment Stats Two widgets for the 'People' tab. - No of people employed full time (```forempl``` x 1000) - ...of which are female (```femempl``` x 1000) - Net USD generate by forest ({```usdrev``` - ```usdexp```} x 1000) - GDP in USD in 2012 (```gdpusd2012``` x 1000) **NOTE: GDP in year=9999** ...
github_jupyter
``` import numpy as np import tensorflow as tf from sklearn.linear_model import LogisticRegression from sklearn.metrics import roc_auc_score import json import pickle from sklearn.externals import joblib import sys sys.path.append('../src/') from TFExpMachine import TFExpMachine, simple_batcher ``` # Load data (see m...
github_jupyter
# Python 101 ``` from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all" ``` ### First code in Python #### Running (executing) a cell Jupyter Notebooks allow code to be separated into sections that can be executed independent of one another. These sections are call...
github_jupyter
# Working with Data in OpenCV Now that we have whetted our appetite for machine learning, it is time to delve a little deeper into the different parts that make up a typical machine learning system. Machine learning is all about building mathematical models in order to understand data. The learning aspect enters this...
github_jupyter
<a href="https://colab.research.google.com/github/alijablack/data-science/blob/main/Wikipedia_NLP_Sentiment_Analysis.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Natural Language Processing ## Problem Statement Use natural language processing...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Libraries-&amp;-settings" data-toc-modified-id="Libraries-&amp;-settings-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Libraries &amp; settings</a></span></li><li><span><a href="#Metrics" data-toc-modif...
github_jupyter
# Introduction to Modeling Libraries ``` import numpy as np import pandas as pd np.random.seed(12345) import matplotlib.pyplot as plt plt.rc('figure', figsize=(10, 6)) PREVIOUS_MAX_ROWS = pd.options.display.max_rows pd.options.display.max_rows = 20 np.set_printoptions(precision=4, suppress=True) ``` ## Interfacing Be...
github_jupyter
``` import torch # Check if pytorch is using GPU: print('Used device name: {}'.format(torch.cuda.get_device_name(0))) ``` Import your google drive if necessary. ``` from google.colab import drive drive.mount('/content/drive') import sys import os ROOT_DIR = 'your_dir' sys.path.insert(0, ROOT_DIR) import pickle import...
github_jupyter
# Notebook version of NSGA-II constrained, without scoop ``` %matplotlib inline #!/usr/bin/env python # This file is part of DEAP. # # DEAP is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, ...
github_jupyter
![Xilinx Logo](images/xilinx_logo.png "Xilinx Logo") # 1. Introduction This notebook demonstrates how to create two parallel video pipelines using the GStreamer multimedia framework: * The first pipeline captures video from a V4L2 device and displays the output on a monitor using a DRM/KMS display device. * The secon...
github_jupyter
# Running a Federated Cycle with Synergos In a federated learning system, there are many contributory participants, known as Worker nodes, which receive a global model to train on, with their own local dataset. The dataset does not leave the individual Worker nodes at any point, and remains private to the node. The j...
github_jupyter
``` import torch import torch.nn as nn import numpy as np from copy import deepcopy device = "cuda" if torch.cuda.is_available() else "cpu" class RBF(nn.Module): def __init__(self): super(RBF, self).__init__() torch.cuda.manual_seed(0) self.rbf_clt = self.init_clt() self.rb...
github_jupyter
``` import os import numpy as np import sys import matplotlib.pyplot as plt from matplotlib import rc from matplotlib.pyplot import cm from library.trajectory import Trajectory # uzh trajectory toolbox sys.path.append(os.path.abspath('library/rpg_trajectory_evaluation/src/rpg_trajectory_evaluation')) import plot_utils ...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Goal" data-toc-modified-id="Goal-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Goal</a></span></li><li><span><a href="#Var" data-toc-modified-id="Var-2"><span class="toc-item-num">2&nbsp;&nbsp;</span>Va...
github_jupyter
# Distributed Object Tracker RL training with Amazon SageMaker RL and RoboMaker --- ## Introduction In this notebook, we show you how you can apply reinforcement learning to train a Robot (named Waffle) track and follow another Robot (named Burger) by using the [Clipped PPO](https://coach.nervanasys.com/algorithms/p...
github_jupyter
# This jupyter notebook contains examples of - some basic functions related to Global Distance Test (GDT) analyses - local accuracy plot ``` %matplotlib notebook import numpy as np import matplotlib.pyplot as plt import MDAnalysis as mda import pyrexMD.misc as misc import pyrexMD.core as core import pyrexMD.topology ...
github_jupyter
# Text Using Markdown **If you double click on this cell**, you will see the text change so that all of the formatting is removed. This allows you to edit this block of text. This block of text is written using [Markdown](http://daringfireball.net/projects/markdown/syntax), which is a way to format text using headers,...
github_jupyter
<h3> ABSTRACT </h3> All CMEMS in situ data products can be found and downloaded after [registration](http://marine.copernicus.eu/services-portfolio/register-now/) via [CMEMS catalogue] (http://marine.copernicus.eu/services-portfolio/access-to-products/). Such channel is advisable just for sporadic netCDF donwloading ...
github_jupyter
# TensorFlow script mode training and serving Script mode is a training script format for TensorFlow that lets you execute any TensorFlow training script in SageMaker with minimal modification. The [SageMaker Python SDK](https://github.com/aws/sagemaker-python-sdk) handles transferring your script to a SageMaker train...
github_jupyter
# Rekurrente Netze (RNNs) ## Sequentialle Daten <img src="img/ag/Figure-22-001.png" style="width: 10%; margin-left: auto; margin-right: auto;"/> ## Floating Window <img src="img/ag/Figure-22-002.png" style="width: 20%; margin-left: auto; margin-right: auto;"/> ## Verarbeitung mit MLP <img src="img/ag/Figure-22-00...
github_jupyter
# This notebook is copied from [here](https://github.com/warmspringwinds/tensorflow_notes/blob/master/tfrecords_guide.ipynb) with some small changes --- ### Introduction In this post we will cover how to convert a dataset into _.tfrecord_ file. Binary files are sometimes easier to use, because you don't have to spec...
github_jupyter
# Custom Models in pycalphad: Viscosity ## Viscosity Model Background We are going to take a CALPHAD-based property model from the literature and use it to predict the viscosity of Al-Cu-Zr liquids. For a binary alloy liquid under small undercooling, Gąsior suggested an entropy model of the form $$\eta = (\sum_i x_i...
github_jupyter
# Section 3.3 ``` %run preamble.py danish = pd.read_csv("../Data/danish.csv").x.values ``` # MLE of composite models ``` parms, BIC, AIC = mle_composite(danish, (1,1,1), "gam-par") fit_gam_par = pd.DataFrame(np.append(parms, [AIC, BIC])).T fit_gam_par.columns = ["shape", "tail", "thres", "AIC","BIC"] print(fit_gam_p...
github_jupyter
# "[Prob] Basics of the Poisson Distribution" > "Some useful facts about the Poisson distribution" - toc:false - branch: master - badges: false - comments: true - author: Peiyi Hung - categories: [category, learning, probability] # Introduction The Poisson distribution is an important discrete probability distributi...
github_jupyter
# Introduction ``` #r "BoSSSpad.dll" using System; using System.Collections.Generic; using System.Linq; using ilPSP; using ilPSP.Utils; using BoSSS.Platform; using BoSSS.Platform.LinAlg; using BoSSS.Foundation; using BoSSS.Foundation.XDG; using BoSSS.Foundation.Grid; using BoSSS.Foundation.Grid.Classic; ...
github_jupyter
# <img style="float: left; padding-right: 10px; width: 45px" src="https://raw.githubusercontent.com/Harvard-IACS/2018-CS109A/master/content/styles/iacs.png"> CS109B Data Science 2: Advanced Topics in Data Science ## Lab 2 - Smoothers and Generalized Additive Models **Harvard University**<br> **Spring 2019**<br> **In...
github_jupyter
### **Install ChEMBL client for getting the dataset** #### **https://www.ebi.ac.uk/chembl/** ``` !pip install chembl_webresource_client ``` ### **Import Libraries** ``` import pandas as pd from chembl_webresource_client.new_client import new_client ``` ### **Find Coronavirus Dataset** #### **Search Target** ``` ...
github_jupyter
# Facial Keypoint Detection This project will be all about defining and training a convolutional neural network to perform facial keypoint detection, and using computer vision techniques to transform images of faces. The first step in any challenge like this will be to load and visualize the data you'll be working ...
github_jupyter
``` import warnings import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.colors import LogNorm from astropy.io import fits from astropy.table import Table import pandas as pd import numpy as np np.seterr(divide='ignore') warnings.filterwarnings("ignore", category=RuntimeWarning) class HRCevt...
github_jupyter
# Parameterizing with Continuous Variables ``` from IPython.display import Image ``` ## Continuous Factors 1. Base Class for Continuous Factors 2. Joint Gaussian Distributions 3. Canonical Factors 4. Linear Gaussian CPD In many situations, some variables are best modeled as taking values in some continuous space. E...
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
``` # 使下面的代码支持python2和python3 from __future__ import division, print_function, unicode_literals # 查看python的版本是否为3.5及以上 import sys assert sys.version_info >= (3, 5) # 查看sklearn的版本是否为0.20及以上 import sklearn assert sklearn.__version__ >= "0.20" import numpy as np import pandas as pd from matplotlib import pyplot as plt ...
github_jupyter
``` import pandas as pd from datetime import datetime, timedelta import time import requests import numpy as np import json import urllib from pandas.io.json import json_normalize import re import os.path import zipfile from glob import glob url ="https://api.usaspending.gov/api/v1/awards/?limit=100" r = requests.get(u...
github_jupyter
# Understanding Classification and Logistic Regression with Python ## Introduction This notebook contains a short introduction to the basic principles of classification and logistic regression. A simple Python simulation is used to illustrate these principles. Specifically, the following steps are performed: - A dat...
github_jupyter
# Implementation of Softmax Regression from Scratch :label:`chapter_softmax_scratch` Just as we implemented linear regression from scratch, we believe that multiclass logistic (softmax) regression is similarly fundamental and you ought to know the gory details of how to implement it from scratch. As with linear regr...
github_jupyter
<table align="left"> <td> <a target="_blank" href="https://colab.research.google.com/github/ShopRunner/collie/blob/main/tutorials/05_hybrid_model.ipynb"><img src="https://www.tensorflow.org/images/colab_logo_32px.png" /> Run in Google Colab</a> </td> <td> <a target="_blank" href="https://github.com/ShopRu...
github_jupyter
# Implicit Georeferencing This workbook sets explicit georeferences from implicit georeferencing through names of extents given in dataset titles or keywords. A file `sources.py` needs to contain the CKAN and SOURCE config as follows: ``` CKAN = { "dpaw-internal":{ "url": "http://internal-data.dpaw.wa.gov.au/"...
github_jupyter
<a href="https://colab.research.google.com/github/xavoliva6/dpfl_pytorch/blob/main/experiments/exp_FedMNIST.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #Experiments on FedMNIST **Colab Support**<br/> Only run the following lines if you want to ...
github_jupyter
``` # for reading and validating data import emeval.input.spec_details as eisd import emeval.input.phone_view as eipv import emeval.input.eval_view as eiev # Visualization helpers import emeval.viz.phone_view as ezpv import emeval.viz.eval_view as ezev import emeval.viz.geojson as ezgj import pandas as pd # Metrics hel...
github_jupyter
<img width="100" src="https://carbonplan-assets.s3.amazonaws.com/monogram/dark-small.png" style="margin-left:0px;margin-top:20px"/> # Forest Emissions Tracking - Validation _CarbonPlan ClimateTrace Team_ This notebook compares our estimates of country-level forest emissions to prior estimates from other groups. The ...
github_jupyter
*Call expressions* invoke [functions](functions), which are named operations. The name of the function appears first, followed by expressions in parentheses. For example, `abs` is a function that returns the absolute value of the input argument: ``` abs(-12) ``` `round` is a function that returns the input argument ...
github_jupyter
## Don't worry if you don't understand everything at first! You're not supposed to. We will start using some "black boxes" and then we'll dig into the lower level details later. ## To start, focus on what things DO, not what they ARE. # What is NLP? Natural Language Processing is technique where computers tr...
github_jupyter
To aid autoassociative recall (sparse recall using partial pattern), we need to two components - 1. each pattern remembers a soft mask of the contribution of each element in activating it. For example, if an element varies a lot at high activation levels, that element should be masked out when determining activation. ...
github_jupyter
Original samples in https://fslab.org/FSharp.Charting/FurtherSamples.html ``` #load "FSharp.Charting.Paket.fsx" #load "FSharp.Charting.fsx" ``` ## Sample data ``` open FSharp.Charting open System open System.Drawing let data = [ for x in 0 .. 99 -> (x,x*x) ] let data2 = [ for x in 0 .. 99 -> (x,sin(float x / 10.0))...
github_jupyter
# Examples for Bounded Innovation Propagation (BIP) MM ARMA parameter estimation ``` import numpy as np import scipy.signal as sps import robustsp as rsp import matplotlib.pyplot as plt import matplotlib # Fix random number generator for reproducibility np.random.seed(1) ``` ## Example 1: AR(1) with 30 percent isola...
github_jupyter
# Perceptron ### TODO - **[ok]** Ajouter dans le code la fonction d'évaluation du réseau - **[ok]** Plot de $\sum |E|$ par itération (i.e. num updates par itération) - Critere d'arrêt + générale - Lire l'article de rérérence - Ajouter la preuve de convergence - Ajouter notations et explications - Tester l'autre versi...
github_jupyter
## Load Weight ``` import torch import numpy as np path = './output/0210/Zero/checkpoint_400.pth' import os assert(os.path.isfile(path)) weight = torch.load(path) input_dim = weight['input_dim'] branchNum = weight['branchNum'] IOScale = weight['IOScale'] state_dict = weight['state_dict']...
github_jupyter
# OneHotEncoder Performs One Hot Encoding. The encoder can select how many different labels per variable to encode into binaries. When top_categories is set to None, all the categories will be transformed in binary variables. However, when top_categories is set to an integer, for example 10, then only the 10 most po...
github_jupyter
``` from eva_cttv_pipeline.clinvar_xml_utils import * from consequence_prediction.repeat_expansion_variants.clinvar_identifier_parsing import parse_variant_identifier import os import sys import urllib import requests import xml.etree.ElementTree as ElementTree from collections import Counter import hgvs.parser from ...
github_jupyter
# GPU ``` gpu_info = !nvidia-smi gpu_info = '\n'.join(gpu_info) print(gpu_info) ``` # CFG ``` CONFIG_NAME = 'config41.yml' debug = False from google.colab import drive, auth # ドライブのマウント drive.mount('/content/drive') # Google Cloudの権限設定 auth.authenticate_user() def get_github_secret(): import json ...
github_jupyter