code
stringlengths
2.5k
150k
kind
stringclasses
1 value
``` import torch from torch.autograd import grad import torch.nn as nn from numpy import genfromtxt import torch.optim as optim import matplotlib.pyplot as plt import torch.nn.functional as F import math tuberculosis_data = genfromtxt('tuberculosis.csv', delimiter=',') #in the form of [t, S,L,I,T] torch.manual_seed(1...
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 pytest from scipy.stats import zscore from mne.preprocessing import create_ecg_epochs from sklearn.model_selection import train_test_split %run parameters.py %run Utility_Functions.ipynb %matplotlib qt5 data = np.load('All_Subject_IR_Index_'+str(epoch_length)+'.npy') print(data.shape) sb.set() def ir_plot(da...
github_jupyter
# Produit matriciel avec une matrice creuse Les dictionnaires sont une façon assez de représenter les matrices creuses en ne conservant que les coefficients non nuls. Comment écrire alors le produit matriciel ? ``` from jyquickhelper import add_notebook_menu add_notebook_menu() ``` ## Matrice creuse et dictionnaire ...
github_jupyter
<a href="https://colab.research.google.com/github/mohd-faizy/03_TensorFlow_In-Practice/blob/master/03_callbacks.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # __Callbacks API__ A __callback__ is an object that can perform actions at various stag...
github_jupyter
``` from PIL import Image import numpy as np import os import cv2 import keras from keras.utils import np_utils from keras.models import Sequential from keras.layers import Conv2D,MaxPooling2D,Dense,Flatten,Dropout import pandas as pd import sys import tensorflow as tf %matplotlib inline import matplotlib.pyplot as plt...
github_jupyter
# Loan predictions ## Problem Statement We want to automate the loan eligibility process based on customer details that are provided as online application forms are being filled. You can find the dataset [here](https://drive.google.com/file/d/1h_jl9xqqqHflI5PsuiQd_soNYxzFfjKw/view?usp=sharing). These details concern ...
github_jupyter
# Looking at the randomness (or otherwise) of mouse behaviour ### Also, the randomness (or otherwise) of trial types to know when best to start looking at 'full task' behaviour ``` # Import libraries import matplotlib.pyplot as plt %matplotlib inline import pandas as pd import seaborn as sns import random import copy...
github_jupyter
# ClarityViz ## Pipeline: .img -> histogram .nii -> graph represented as csv -> graph as graphml -> plotly ### To run: ### Step 1: First, run the following. This takes the .img, generates the localeq histogram as an nii file, gets the nodes and edges as a csv and converts the csv into a graphml ``` python runclar...
github_jupyter
``` { "nodes": [ { "op": "null", "name": "data", "inputs": [] }, { "op": "null", "name": "mobilenet0_conv0_weight", "attrs": { "__dtype__": "0", "__lr_mult__": "1.0", "__shape__": "(8L, 3L, 3L, 3L)", "__storage_type__": "0", ...
github_jupyter
# Mixture Density Networks with Edward, Keras and TensorFlow This notebook explains how to implement Mixture Density Networks (MDN) with Edward, Keras and TensorFlow. Keep in mind that if you want to use Keras and TensorFlow, like we do in this notebook, you need to set the backend of Keras to TensorFlow, [here](http:...
github_jupyter
<H3>Importing Required Libraries ``` from pyspark.sql import SparkSession from pyspark.sql import functions as F ``` <H3>Getting Spark Session ``` spark = SparkSession.builder.getOrCreate() ``` <H3>Reading CSV ``` df = spark.read.csv("Big_Cities_Health_Data_Inventory.csv", header=True) df.show(10) ``` <H3>Printin...
github_jupyter
# Exploratory Data Analysis * Dataset taken from https://github.com/Tariq60/LIAR-PLUS ## 1. Import Libraries ``` import os import numpy as np import pandas as pd import matplotlib.pyplot as plt TRAIN_PATH = "../data/raw/dataset/tsv/train2.tsv" VAL_PATH = "../data/raw/dataset/tsv/val2.tsv" TEST_PATH = "../data/raw/d...
github_jupyter
``` #hide #skip ! [[ -e /content ]] && pip install -Uqq fastai # upgrade fastai on colab #default_exp collab #default_class_lvl 3 #export from fastai.tabular.all import * #hide from nbdev.showdoc import * ``` # Collaborative filtering > Tools to quickly get the data and train models suitable for collaborative filter...
github_jupyter
# ***Introduction to Radar Using Python and MATLAB*** ## Andy Harrison - Copyright (C) 2019 Artech House <br/> # Pulse Train Ambiguity Function *** Referring to Section 8.6.1, the amibguity function for a coherent pulse train is found by employing the generic waveform technique outlined in Section 8.6.3. *** Begin b...
github_jupyter
# 5.2 Fourier transform and Fourier series We make use of the theory of tempered distributions (see [@strichartz2003guide] for an introduction) and we begin by collecting some results of independent interest, which will also be important later. ## 5.2.1 Fourier transform Before studying the Fourier transform, we fir...
github_jupyter
``` from sklearn.model_selection import train_test_split import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler from keras.utils import to_categorical from keras.models import Sequential from keras.layers import Dense #df = pd.read_csv(".\\Data_USD.csv", header=None,skiprows=1) df = pd....
github_jupyter
# Nonlinear recharge models *R.A. Collenteur, University of Graz* This notebook explains the use of the `RechargeModel` stress model to simulate the combined effect of precipitation and potential evaporation on the groundwater levels. For the computation of the groundwater recharge, three recharge models are currently...
github_jupyter
# Place Stock Trades into Senator Dataframe ## 1. Understand the Senator Trading Report (STR) Dataframe ``` import pandas as pd #https://docs.google.com/spreadsheets/d/1lH_LpTgRlfzKvpRnWYgoxlkWvJj0v1r3zN3CeWMAgqI/edit?usp=sharing try: sen_df = pd.read_csv("Senator Stock Trades/Senate Stock Watcher 04_16_2020 All ...
github_jupyter
# Collaborative filtering on Google Analytics data This notebook demonstrates how to implement a WALS matrix refactorization approach to do collaborative filtering. ``` import os PROJECT = "qwiklabs-gcp-00-34ffb0f0dc65" # REPLACE WITH YOUR PROJECT ID BUCKET = "cloud-training-demos-ml" # REPLACE WITH YOUR BUCKET NAME ...
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> # Computing the 4-Velocity Time-Component $u^0$, the Magnet...
github_jupyter
``` # import re # import tensorflow as tf # from tensorflow.keras.preprocessing.text import text_to_word_sequence # tokens=text_to_word_sequence("manta.com/c/mmcdqky/lily-co") # print(tokens) # #to map the features to a dictioanary and then convert it to a csv file. # # Feauture extraction # class feature_extracto...
github_jupyter
``` from sklearn.preprocessing import LabelBinarizer from keras.datasets import cifar10 from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential, model_from_json from keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau from keras.constraints import maxnorm from ...
github_jupyter
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_04_1_feature_encode.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 4: Training for...
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/categorical-variables).** --- By encoding **categorical variables**, you'll obtain your best resul...
github_jupyter
##### Copyright 2018 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" } # you may not use this file except in compliance with the License. # You may obtain a copy of the License at...
github_jupyter
<a href="https://colab.research.google.com/github/cseveriano/spatio-temporal-forecasting/blob/master/notebooks/thesis_experiments/20200924_eMVFTS_Wind_Energy_Raw.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Forecasting experiments for GEFCOM 2...
github_jupyter
# Use `Lale` `AIF360` scorers to calculate and mitigate bias for credit risk AutoAI model This notebook contains the steps and code to demonstrate support of AutoAI experiments in Watson Machine Learning service. It introduces commands for bias detecting and mitigation performed with `lale.lib.aif360` module. Some fa...
github_jupyter
# Trade-off between classification accuracy and reconstruction error during dimensionality reduction - Low-dimensional LSTM representations are excellent at dimensionality reduction, but are poor at reconstructing the original data - On the other hand, PCs are excellent at reconstructing the original data but these hi...
github_jupyter
``` imatlab_export_fig('print-png') ``` # Quadrature rules for 2.5-D resistivity modelling We consider the evaluation of the integral $$ \Phi(x, y, z) = \frac{2}{\pi} \int_0^\infty \tilde\Phi(k, y, z) \cos(k x)\, dk $$ where $$ \tilde\Phi(k, y, z) = K_0\left({k}{\sqrt{y^2 + z^2}}\right). $$ The function $\tilde\Ph...
github_jupyter
# Introduction to Gym toolkit ## Gym Environments The centerpiece of Gym is the environment, which defines the "game" in which your reinforcement algorithm will compete. An environment does not need to be a game; however, it describes the following game-like features: * **action space**: What actions can we take on ...
github_jupyter
| Name | Description | Date | :- |-------------: | :-: |<font color=red>__Reza Hashemi__</font>| __Function approximation by linear model and deep network LOOP test__. | __On 10th of August 2019__ # Function approximation with linear models and neural network * Are Linear models sufficient for approximating transcede...
github_jupyter
# Controlling Flow with Conditional Statements Now that you've learned how to create conditional statements, let's learn how to use them to control the flow of our programs. This is done with `if`, `elif`, and `else` statements. ## The `if` Statement What if we wanted to check if a number was divisible by 2 and if...
github_jupyter
# Laboratorio 8 ``` import pandas as pd import matplotlib.pyplot as plt from sklearn import datasets from sklearn.neighbors import KNeighborsClassifier from sklearn.linear_model import LogisticRegression from sklearn.metrics import plot_confusion_matrix %matplotlib inline digits_X, digits_y = datasets.load_digits(r...
github_jupyter
# **Spit some [tensor] flow** We need to learn the intricacies of tensorflow to master deep learning `Let's get this over with` ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import tensorflow as tf import cv2 print(tf.__version__) def evaluation_tf(report, y_test, y_pred, classes): plt...
github_jupyter
# Google Apps Workspace ## Imports ``` %matplotlib inline import os import pandas as pd import numpy as np import seaborn as sns from matplotlib import pyplot as plt ``` ## Load Dataset ``` apps_df = pd.read_csv('googleplaystore.csv', index_col = 0) reviews_df = pd.read_csv('googleplaystore_user_reviews.csv', index...
github_jupyter
# Geolocalizacion de dataset de escuelas argentinas ``` #Importar librerias import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import warnings warnings.filterwarnings('ignore') ``` ### Preparacion de data ``` # Vamos a cargar un padron de escuelas de Argentina # Estos son los nombres de columna...
github_jupyter
# Combining DataFrames with pandas In many "real world" situations, the data that we want to use come in multiple files. We often need to combine these files into a single DataFrame to analyze the data. The pandas package provides [various methods for combining DataFrames](http://pandas.pydata.org/pandas-docs/stable/m...
github_jupyter
# Chapter 13: Analyzing sound waves with Fourier Series Helper functions ``` import matplotlib.pyplot as plt def plot_function(f,xmin,xmax,**kwargs): ts = np.linspace(xmin,xmax,1000) plt.plot(ts,[f(t) for t in ts],**kwargs) def plot_sequence(points,max=100,line=False,**kwargs): if line: plt.p...
github_jupyter
# info ##### クレンジング 1. 欠損値があった場合、基礎分析の結果に基づいて値埋めか行の削除を行なっている 1. 表記揺れがあった場合、漏れなく修正している 1. 水準数が多く、なおかつまとめられそうな質的変数があった場合に、論理的な基準に基づいて値をまとめている ##### 特徴量エンジニアリング 1. 質的変数を量的変数(加減乗除して意味のある数値)に変換している 1. 量的変数を基礎分析の結果をもとに変換している 1. 量的変数のスケーリングを行っている 1. 元データを素に、有用であると考えられるような特徴を少なくとも1は生成している # init ``` import numpy as np impo...
github_jupyter
# FloPy shapefile export demo The goal of this notebook is to demonstrate ways to export model information to shapefiles. This example will cover: * basic exporting of information for a model, individual package, or dataset * custom exporting of combined data from different packages * general exporting and importing of...
github_jupyter
# BERT finetuning on AG_news-4 ## Librairy ``` # !pip install transformers==4.8.2 # !pip install datasets==1.7.0 import os import time import pickle import numpy as np import torch from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, recall_score, precision_score, f1_scor...
github_jupyter
This tutorial shows how to generate an image of handwritten digits using Deep Convolutional Generative Adversarial Network (DCGAN). Generative Adversarial Networks (GANs) are one of the most interesting fields in machine learning. The standard GAN consists of two models, a generative and a discriminator one. Two model...
github_jupyter
## Setup If you are running this generator locally(i.e. in a jupyter notebook in conda, just make sure you installed: - RDKit - DeepChem 2.5.0 & above - Tensorflow 2.4.0 & above Then, please skip the following part and continue from `Data Preparations`. To increase efficiency, we recommend running this molecule gene...
github_jupyter
``` import pandas as pd import numpy as np import glob result_file = '/tmp/fuzzydatatest/20220209-150332_perf.csv' perf_df = pd.read_csv(result_file, index_col=0) perf_df import numpy as np perf_df['end_time_seconds'] = np.cumsum(perf_df.elapsed_time) perf_df['start_time_seconds'] = end_time.shift().fillna(0) perf_df ...
github_jupyter
# DataMining TwitterAPI Requirements: - TwitterAccount - TwitterApp credentials ## Imports The following imports are requiered to mine data from Twitter ``` # http://tweepy.readthedocs.io/en/v3.5.0/index.html import tweepy # https://api.mongodb.com/python/current/ import pymongo import json import sys ``` ## Access...
github_jupyter
# Graphs from the presentation ``` import matplotlib.pyplot as plt %matplotlib notebook # create a new figure plt.figure() # create x and y coordinates via lists x = [99, 19, 88, 12, 95, 47, 81, 64, 83, 76] y = [43, 18, 11, 4, 78, 47, 77, 70, 21, 24] # scatter the points onto the figure plt.scatter(x, y) # create a...
github_jupyter
<a href="https://colab.research.google.com/github/VxctxrTL/daa_2021_1/blob/master/28Octubre.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ### SOLUCION 1 ``` h1 = 0 h2 = 0 m1 = 0 m2 = 0 # 1440 + 24 *6 contador = 0 # 5 + (1440 + ?) * 2 + 144 + ...
github_jupyter
## Getting ready ``` import tensorflow as tf import tensorflow.keras as keras import pandas as pd import numpy as np census_dir = 'https://archive.ics.uci.edu/ml/machine-learning-databases/adult/' train_path = tf.keras.utils.get_file('adult.data', census_dir + 'adult.data') test_path = tf.keras.utils.get_file('adult.t...
github_jupyter
# Automated Machine Learning #### Forecasting away from training data ## Contents 1. [Introduction](#Introduction) 2. [Setup](#Setup) 3. [Data](#Data) 4. [Prepare remote compute and data.](#prepare_remote) 4. [Create the configuration and train a forecaster](#train) 5. [Forecasting from the trained model](#forecasti...
github_jupyter
``` import pandas as pd import seaborn as sns import scipy import matplotlib.pyplot as plt df_Dodgers = pd.read_csv('dodgers.csv') df_Dodgers.head() # Takes binary categories and returns 0 or 1 def binning_cats(word, zero='no', one='yes'): if word.strip().lower()==zero: return(0) elif word.strip().lower...
github_jupyter
``` import torch import torch.nn as nn from torch.nn import functional as F from torch.utils.data import Dataset, DataLoader from torch.utils.tensorboard import SummaryWriter writer = SummaryWriter() import pandas as pd import numpy as np import matplotlib.pyplot as plt plt.rcParams['figure.dpi']= 100 import seaborn...
github_jupyter
# Introduction and Foundations: Titanic Survival Exploration > Udacity Machine Learning Engineer Nanodegree: _Project 0_ > > Author: _Ke Zhang_ > > Submission Date: _2017-04-27_ (Revision 2) ## Abstract In 1912, the ship RMS Titanic struck an iceberg on its maiden voyage and sank, resulting in the deaths of most of ...
github_jupyter
<a href="https://colab.research.google.com/github/darshanbk/100-Days-Of-ML-Code/blob/master/Getting_started_with_BigQuery.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Before you begin 1. Use the [Cloud Resource Manager](https://console.clou...
github_jupyter
# Solving Multi-armed Bandit Problems We will focus on how to solve the multi-armed bandit problem using four strategies, including epsilon-greedy, softmax exploration, upper confidence bound, and Thompson sampling. We will see how they deal with the exploration-exploitation dilemma in their own unique ways. We will a...
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
# Data Space Report <img src="images/polito_logo.png" alt="Polito Logo" style="width: 200px;"/> ## Pittsburgh Bridges Data Set <img src="images/andy_warhol_bridge.jpg" alt="Andy Warhol Bridge" style="width: 200px;"/> Andy Warhol Bridge - Pittsburgh. Report created by Student Francesco Maria Chiarlo s253666, ...
github_jupyter
# Setup First, let's import a few common modules, ensure MatplotLib plots figures inline and prepare a function to save the figures. We also check that Python 3.5 or later is installed (although Python 2.x may work, it is deprecated so we strongly recommend you use Python 3 instead), as well as Scikit-Learn ≥0.20. ``...
github_jupyter
<a href="https://colab.research.google.com/github/JamesHorrex/AI_stock_trading/blob/master/SS_AITrader_INTC.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` %matplotlib inline import numpy as np import tensorflow as tf print(tf.__version__) !pip ...
github_jupyter
# Deriving a Point-Spread Function in a Crowded Field ### following Appendix III of Peter Stetson's *User's Manual for DAOPHOT II* ### Using `pydaophot` form `astwro` python package All *italic* text here have been taken from Stetson's manual. The only input file for this procedure is a FITS file containing reference...
github_jupyter
``` # python standard library import sys import os import operator import itertools import collections import functools import glob import csv import datetime import bisect import sqlite3 import subprocess import random import gc import shutil import shelve import contextlib import tempfile import math import pickle # ...
github_jupyter
# 内容 - lightGBMモデル初版 - ターゲットエンコーディング:Holdout TS - 外部データ3つ(ステージ面積1,ステージ面積2,ブキ)を結合 - ステージ面積1: https://probspace-stg.s3-ap-northeast-1.amazonaws.com/uploads/user/c10947bba5cde4ad3dd4a0d42a0ec35b/files/2020-09-06-0320/stagedata.csv - ステージ面積2:https://stat.ink/api-info/stage2 - ブキ:https://stat.ink/api-info/we...
github_jupyter
``` import numpy as np from copy import deepcopy from scipy.special import expit from scipy.optimize import minimize from sklearn.datasets import load_iris from sklearn.linear_model import LogisticRegression as skLogisticRegression from sklearn.multiclass import OneVsRestClassifier as skOneVsRestClassifier class OneVsR...
github_jupyter
``` import tensorflow as tf from keras.layers import Conv1D, Dense, Dropout, Concatenate, GlobalAveragePooling1D, GlobalMaxPooling1D, Input, MaxPooling1D, Flatten from keras.optimizers import Adam from keras.losses import sparse_categorical_crossentropy from sklearn.model_selection import train_test_split from keras.ut...
github_jupyter
# OPTIMIZATION PHASES ### List of variables <table> <thead> <tr> <th style="width: 10%">Variable</th> <th style="width: 45%">Description</th> <th style="width: 30%">Comment</th> </tr> </thead> <tbody> <tr> <td>$B$</td> <td...
github_jupyter
# BLU15 - Model CSI ## Intro: It often happens that your data distribution changes with time. More than that, sometimes you don't know how a model was trained and what was the original training data. In this learning unit we're going to try to identify whether an existing model meets our expectations and redeploy...
github_jupyter
# Reviewing Automated Machine Learning Explanations As machine learning becomes more and more and more prevelant, the predictions made by models have greater influence over many aspects of our society. For example, machine learning models are an increasingly significant factor in how banks decide to grant loans or doc...
github_jupyter
# Classifying Fashion-MNIST Now it's your turn to build and train a neural network. You'll be using the [Fashion-MNIST dataset](https://github.com/zalandoresearch/fashion-mnist), a drop-in replacement for the MNIST dataset. MNIST is actually quite trivial with neural networks where you can easily achieve better than 9...
github_jupyter
``` import numpy as np #Load the predicted 9x12 array #1st pass im1=np.array([[4,4,4,4,4,4,4,4,4,4,4,4], [6,6,2,1,6,6,6,6,6,1,1,2], [6,6,6,1,1,6,6,6,6,1,1,2], [2,6,6,6,1,5,5,5,6,1,1,2], [5,6,6,6,5,5,5,5,5,1,5,5], [5,5,2,5,5,5,5,5,5,1,5,5], ...
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> # Start-to-Finish Example: Unit Testing `GiRaFFE_NRPy`: $A_...
github_jupyter
http://www.yr.no/place/Norway/Telemark/Vinje/Haukeliseter/climate.month12.html ``` import matplotlib.pyplot as plt import matplotlib.dates as dates import numpy as np import csv import pandas as pd import datetime from datetime import date import calendar %matplotlib inline year = np.arange(2000,2017, 1) T_av = [-4.1...
github_jupyter
# DB2 Jupyter Notebook Extensions Version: 2021-08-23 This code is imported as a Jupyter notebook extension in any notebooks you create with DB2 code in it. Place the following line of code in any notebook that you want to use these commands with: <pre> &#37;run db2.ipynb </pre> This code defines a Jupyter/Python mag...
github_jupyter
# Profiling TensorFlow Multi GPU Multi Node Training Job with Amazon SageMaker Debugger This notebook will walk you through creating a TensorFlow training job with the SageMaker Debugger profiling feature enabled. It will create a multi GPU multi node training using Horovod. ### (Optional) Install SageMaker and SMDe...
github_jupyter
## Лабораторная работа 2 - Линейная и полиномиальная регрессия. Одна из множества задач, которой занимается современная физика это поиск материала для изготовления сверхпроводника, работающего при комнатной температуре. Кроме теоретических методов есть и подход со стороны статистики, который подразумевает анализ базы ...
github_jupyter
``` import sys import os sys.path.append(os.path.abspath("../src/")) import extract.data_loading as data_loading import extract.compute_predictions as compute_predictions import extract.compute_shap as compute_shap import extract.compute_ism as compute_ism import model.util as model_util import model.profile_models as ...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#init" data-toc-modified-id="init-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>init</a></span></li><li><span><a href="#モデリング" data-toc-modified-id="モデリング-2"><span class="toc-item-num">2&nbsp;&nbsp;</spa...
github_jupyter
<a href="https://colab.research.google.com/github/poojan-dalal/fashion-MNIST/blob/master/Course_1_Part_4_Lesson_2_Notebook.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import tensorflow as tf print(tf.__version__) ``` The Fashion MNIST data ...
github_jupyter
# [Advent of Code 2020: Day 10](https://adventofcode.com/2020/day/10) ## \-\-\- Day 10: Adapter Array \-\-\- Patched into the aircraft's data port, you discover weather forecasts of a massive tropical storm. Before you can figure out whether it will impact your vacation plans, however, your device suddenly turns off!...
github_jupyter
<img style="float: right;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOIAAAAjCAYAAACJpNbGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABR0RVh0Q3JlYXRpb24gVGltZQAzLzcvMTNND4u/AAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAACMFJREFUeJztnD1y20gWgD+6nJtzAsPhRqKL3AwqwQdYDpXDZfoEppNNTaWbmD7BUEXmI3EPMF...
github_jupyter
# 7.6 Transformerモデル(分類タスク用)の実装 - 本ファイルでは、クラス分類のTransformerモデルを実装します。 ※ 本章のファイルはすべてUbuntuでの動作を前提としています。Windowsなど文字コードが違う環境での動作にはご注意下さい。 # 7.6 学習目標 1. Transformerのモジュール構成を理解する 2. LSTMやRNNを使用せずCNNベースのTransformerで自然言語処理が可能な理由を理解する 3. Transformerを実装できるようになる # 事前準備 書籍の指示に従い、本章で使用するデータを用意します ``` import math import num...
github_jupyter
# Run model module locally ``` import os # Import os environment variables for file hyperparameters. os.environ["TRAIN_FILE_PATTERN"] = "gs://machine-learning-1234-bucket/gan/data/cifar10/train*.tfrecord" os.environ["EVAL_FILE_PATTERN"] = "gs://machine-learning-1234-bucket/gan/data/cifar10/test*.tfrecord" os.environ[...
github_jupyter
``` # !/usr/bin/env python # 测试tensorflow是否安装好 import numpy as np import tensorflow as tf # Prepare train data train_X = np.linspace(-1, 1, 100) train_Y = 2 * train_X + np.random.randn(*train_X.shape) * 0.33 + 10 # Define the model X = tf.placeholder("float") Y = tf.placeholder("float") w = tf.Variable(0.0, name="we...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import pandas as pd import xarray as xr import seaborn as sns sns.set() ``` #### Check surface fluxes of CO$_2$ ``` # check the data folder to swith to another mixing conditions #ds = xr.open_dataset('data/results_so4_adv/5_po75-25_di10e-9/water.nc') ds = xr.open...
github_jupyter
# Using Ray for Highly Parallelizable Tasks While Ray can be used for very complex parallelization tasks, often we just want to do something simple in parallel. For example, we may have 100,000 time series to process with exactly the same algorithm, and each one takes a minute of processing. Clearly running it on a s...
github_jupyter
<a href="https://colab.research.google.com/github/Collin-Campbell/DS-Unit-2-Linear-Models/blob/master/module3-ridge-regression/LS_DS_213_assignment.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Lambda School Data Science *Unit 2, Sprint 1, Module...
github_jupyter
# Zircon model training notebook; (extensively) modified from Detectron2 training tutorial This Colab Notebook will allow users to train new models to detect and segment detrital zircon from RL images using Detectron2 and the training dataset provided in the colab_zirc_dims repo. It is set up to train a Mask RCNN mode...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sb %matplotlib inline from sklearn.utils.multiclass import unique_labels from sklearn.metrics import confusion_matrix def plot_confusion_matrix(y_true, y_pred, classes, normalize=False, ...
github_jupyter
## Import packages ``` import warnings warnings.filterwarnings("ignore") import pandas as pd # general packages import numpy as np import matplotlib.pyplot as plt import os import seaborn as sns # sklearn models from sklearn.pipeline import make_pipeline from sklearn.preprocessing import StandardScaler from sklearn....
github_jupyter
<table width=60% > <tr style="background-color: white;"> <td><img src='https://www.creativedestructionlab.com/wp-content/uploads/2018/05/xanadu.jpg'></td>></td> </tr> </table> --- <img src='https://raw.githubusercontent.com/XanaduAI/strawberryfields/master/doc/_static/strawberry-fields-text.png'> ---...
github_jupyter
``` import torch import torch.nn as nn import numpy as np import matplotlib.pyplot as plt ``` # Pytorch: An automatic differentiation tool `Pytorch`를 활용하면 복잡한 함수의 미분을 손쉽게 + 효율적으로 계산할 수 있습니다! `Pytorch`를 활용해서 복잡한 심층 신경망을 훈련할 때, 오차함수에 대한 파라미터의 편미분치를 계산을 손쉽게 수행할수 있습니다! ## Pytorch 첫만남 우리에게 아래와 같은 간단한 선형식이 주어져있다고 생각해볼까요...
github_jupyter
# Analyzing IMDB Data in Keras ``` # Imports import numpy as np import keras from keras.datasets import imdb from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.preprocessing.text import Tokenizer import matplotlib.pyplot as plt %matplotlib inline np.random.seed(42) ``` ...
github_jupyter
<a href="https://colab.research.google.com/github/phreakyphoenix/MXNet-GluonCV-AWS-Coursera/blob/master/Module_5_LeNet_on_MNIST.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Graded Assessment In this assessment you will write a full end-to-end ...
github_jupyter
``` import torch from torchtext import data import numpy as np import pandas as pd import torch.nn as nn import torch.nn.functional as F SEED = 1 torch.manual_seed(SEED) torch.cuda.manual_seed(SEED) with open('../stanford-corenlp-full-2018-10-05/stanfordSentimentTreebank/dictionary.txt','r') as f: dic = f.readlin...
github_jupyter
# Callbacks and Multiple inputs ``` import pandas as pd import numpy as np %matplotlib inline import matplotlib.pyplot as plt from sklearn.preprocessing import scale from keras.optimizers import SGD from keras.layers import Dense, Input, concatenate, BatchNormalization from keras.callbacks import EarlyStopping, Tens...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import pandas as pd from pathlib import Path from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import LogisticRegression from sklearn.preprocessing import StandardScaler train_df = pd.read_csv(Path('./Resources/2019loans.csv')) test_df =...
github_jupyter
#Import Data ``` import numpy as np from sklearn.model_selection import GridSearchCV import matplotlib.pyplot as plt # load data import os from google.colab import drive drive.mount('/content/drive') filedir = './drive/My Drive/Final/CNN_data' with open(filedir + '/' + 'feature_extracted', 'rb') as f: X = np.load(f)...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Image/extract_value_to_points.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank"...
github_jupyter
# Fmriprep Today, many excellent general-purpose, open-source neuroimaging software packages exist: [SPM](https://www.fil.ion.ucl.ac.uk/spm/) (Matlab-based), [FSL](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki), [AFNI](https://afni.nimh.nih.gov/), and [Freesurfer](https://surfer.nmr.mgh.harvard.edu/) (with a shell interface)....
github_jupyter
# Software Engineering Software engineering was first introduced in the 1960s in an effort to treat more rigorously the often frustrating task of designing and developing computer programs. It was around this time that the computer community became increasingly worried about the fact that software projects were typica...
github_jupyter
``` # dataset # https://cogcomp.seas.upenn.edu/Data/QA/QC/ import pandas as pd import numpy as np from bs4 import BeautifulSoup import pickle import string from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder import nltk from nltk.corpus import stopwords from nltk.stem.p...
github_jupyter