text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
SD211 TP2: Régression logistique *<p>Author: Pengfei Mi</p>* *<p>Date: 12/05/2017</p>* ``` import numpy as np import matplotlib.pyplot as plt from cervicalcancerutils import load_cervical_cancer from scipy.optimize import check_grad from time import time from sklearn.metrics import classification_report ``` ## Parti...
github_jupyter
# Preprocessing for BraTS, NFBS, and COVIDx8B datasets #### Change file paths in this notebook to match your system! Preprocessing steps taken: BraTS and NFBS: Load images with SimpleITK -> z-score intensity normalization -> break into patches COVIDx8B: Clean up file names and unzip compressed images ``` import pa...
github_jupyter
## Smithsonian OpenAccess Collection Data API Let's use requests to scrape some data from an API endpoint. In this case, we can use the Smithsonian's [Open Access API](https://edan.si.edu/openaccess/apidocs/#api-_), which is a REST API that responds to HTTP requests. See the documentation at [https://edan.si.edu/opena...
github_jupyter
``` # %matplotlib widget from util import get_path import pandas as pd import networkx as nx import numpy as np import matplotlib.pyplot as plt from extract_graph import generate_nx_graph, transform_list, generate_skeleton, generate_nx_graph_from_skeleton, from_connection_tab from node_id import whole_movement_identifi...
github_jupyter
``` import dask from dask.distributed import Client import dask_jobqueue import discretize from discretize.utils import mkvc # import deepdish as dd import h5py import json import matplotlib.pyplot as plt from matplotlib import cm as cmap from matplotlib.colors import LogNorm, Normalize import numpy as np import os imp...
github_jupyter
# Dictionaries and DataFrames Today we are going build dictionaries. Dictionaries are datastructures that do not assume an index value for the data stored in the structures. Dictionaries take the general form: > my_dictionary = {key:obj} To call the object that is linked to the key, > *my_dictionary[key]* will ou...
github_jupyter
# Aim of this notebook * To construct the singular curve of universal type to finalize the solution of the optimal control problem # Preamble ``` from sympy import * init_printing(use_latex='mathjax') # Plotting %matplotlib inline ## Make inline plots raster graphics from IPython.display import set_matplotlib_forma...
github_jupyter
# Logistic Regression (scikit-learn) with HDFS/Spark Data Versioning This example is based on our [basic census income classification example](census-end-to-end.ipynb), using local setups of ModelDB and its client, and [HDFS/Spark data versioning](https://docs.verta.ai/en/master/api/api/versioning.html#verta.dataset.H...
github_jupyter
## Contour deformation In the context of GW method, contour deformation (CD) technique is used in conjunction with resolution of identity (RI) to reduce the formal scaling of the self-energy calculation. Compared to widely used analytic continuation approach it provides a means to evaluate self-energy directly on th...
github_jupyter
# <center>Models and Pricing of Financial Derivativs HW_01</center> **<center>11510691 程远星</center>** ## Question 1 $\DeclareMathOperator*{\argmin}{argmin} \DeclareMathOperator*{\argmax}{argmax} \newcommand{\using}[1]{\stackrel{\mathrm{#1}}{=}} \newcommand{\ffrac}{\displaystyle \frac} \newcommand{\space}{\text{ }} \...
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
# `git`, `GitHub`, `GitKraken` (continuación) <img style="float: left; margin: 15px 15px 15px 15px;" src="http://conociendogithub.readthedocs.io/en/latest/_images/Git.png" width="180" height="50" /> <img style="float: left; margin: 15px 15px 15px 15px;" src="https://c1.staticflickr.com/3/2238/13158675193_2892abac95_z....
github_jupyter
ERROR: type should be string, got "https://github.com/scikit-learn/scikit-learn/issues/18305\n\nThomas' example with Logistic regression:\nhttps://scikit-learn.org/stable/auto_examples/compose/plot_column_transformer_mixed_types.html#sphx-glr-auto-examples-compose-plot-column-transformer-mixed-types-py\n\n```\nimport watermark\n%load_ext watermark\n#!pip install --upgrade scikit-learn\n#!pip install watermark\nimport sklearn\nfrom sklearn import set_config\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.preprocessing import OneHotEncoder, StandardScaler\nfrom sklearn.impute import SimpleImputer\nfrom sklearn.compose import make_column_transformer\nfrom sklearn.linear_model import LogisticRegression\nsklearn.__version__\n# see version of system, python and libraries\n%watermark -n -v -m -g -iv\n#sklearn.set_config(display='diagram')\nset_config(display='diagram')\n\nnum_proc = make_pipeline(SimpleImputer(strategy='median'), StandardScaler())\n\ncat_proc = make_pipeline(\n SimpleImputer(strategy='constant', fill_value='missing'),\n OneHotEncoder(handle_unknown='ignore'))\n\npreprocessor = make_column_transformer((num_proc, ('feat1', 'feat3')),\n (cat_proc, ('feat0', 'feat2')))\n\nclf = make_pipeline(preprocessor, LogisticRegression())\nclf\nfrom sklearn.linear_model import LogisticRegression\n# Author: Pedro Morales <part.morales@gmail.com>\n#\n# License: BSD 3 clause\n\nimport numpy as np\n\nfrom sklearn.compose import ColumnTransformer\nfrom sklearn.datasets import fetch_openml\nfrom sklearn.pipeline import Pipeline\nfrom sklearn.impute import SimpleImputer\nfrom sklearn.preprocessing import StandardScaler, OneHotEncoder\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.model_selection import train_test_split, GridSearchCV\n\nnp.random.seed(0)\n\n# Load data from https://www.openml.org/d/40945\nX, y = fetch_openml(\"titanic\", version=1, as_frame=True, return_X_y=True)\n\n# Alternatively X and y can be obtained directly from the frame attribute:\n# X = titanic.frame.drop('survived', axis=1)\n# y = titanic.frame['survived']\nnumeric_features = ['age', 'fare']\nnumeric_transformer = Pipeline(steps=[\n ('imputer', SimpleImputer(strategy='median')),\n ('scaler', StandardScaler())])\n\ncategorical_features = ['embarked', 'sex', 'pclass']\ncategorical_transformer = Pipeline(steps=[\n ('imputer', SimpleImputer(strategy='constant', fill_value='missing')),\n ('onehot', OneHotEncoder(handle_unknown='ignore'))])\n\npreprocessor = ColumnTransformer(\n transformers=[\n ('num', numeric_transformer, numeric_features),\n ('cat', categorical_transformer, categorical_features)])\n\n# Append classifier to preprocessing pipeline.\n# Now we have a full prediction pipeline.\nclf = Pipeline(steps=[('preprocessor', preprocessor),\n ('classifier', LogisticRegression())])\n\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)\n\nclf.fit(X_train, y_train)\nprint(\"model score: %.3f\" % clf.score(X_test, y_test))\nfrom sklearn import set_config\nset_config(display='diagram')\nclf\nfrom sklearn import svm\nnp.random.seed(0)\n\n# Load data from https://www.openml.org/d/40945\nX, y = fetch_openml(\"titanic\", version=1, as_frame=True, return_X_y=True)\nnumeric_features = ['age', 'fare']\nnumeric_transformer = Pipeline(steps=[\n ('imputer', SimpleImputer(strategy='median')),\n ('scaler', StandardScaler())])\n\ncategorical_features = ['embarked', 'sex', 'pclass']\ncategorical_transformer = Pipeline(steps=[\n ('imputer', SimpleImputer(strategy='constant', fill_value='missing')),\n ('onehot', OneHotEncoder(handle_unknown='ignore'))])\n\npreprocessor = ColumnTransformer(\n transformers=[\n ('num', numeric_transformer, numeric_features),\n ('cat', categorical_transformer, categorical_features)])\n\n# Append classifier to preprocessing pipeline.\n# Now we have a full prediction pipeline.\nclf = Pipeline(steps=[('preprocessor', preprocessor),\n ('classifier', svm.SVC())])\n\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)\n\nclf.fit(X_train, y_train)\nprint(\"model score: %.3f\" % clf.score(X_test, y_test))\nfrom sklearn import set_config\nset_config(display='diagram')\nclf\n```\n\n"
github_jupyter
``` import pandas as pd import numpy as np from tqdm.auto import tqdm train = pd.read_csv("../dataset/validation/train_complete.csv") test = pd.read_csv("../dataset/original/test_complete.csv") # TODO aggiungere anche il resto del train train columns = ['queried_record_id', 'predicted_record_id', 'predicted_record_id_r...
github_jupyter
Train a simple deep CNN on the CIFAR10 small images dataset. It gets to 75% validation accuracy in 25 epochs, and 79% after 50 epochs. (it's still underfitting at that point, though) ``` # https://gist.github.com/deep-diver import warnings;warnings.filterwarnings('ignore') from tensorflow import keras from tensorflo...
github_jupyter
##### Copyright 2020 The TensorFlow IO 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 ...
github_jupyter
### Neural Machine Translation by Jointly Learning to Align and Translate In this notebook we will implement the model from [Neural Machine Translation by Jointly Learning to Align and Translate](https://arxiv.org/abs/1409.0473) that will improve PPL (**perplexity**) as compared to the previous notebook. Here is a ge...
github_jupyter
<a href="https://colab.research.google.com/github/yasirabd/solver-society-job-data/blob/main/2_0_Ekstrak_job_position.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Objective Ekstrak job_position, semakin sedikit jumlah unique semakin bagus. Dat...
github_jupyter
# Tutorial: DESI spectral fitting with `provabgs` ``` # lets install the python package `provabgs`, a python package for generating the PRObabilistic Value-Added BGS (PROVABGS) !pip install git+https://github.com/changhoonhahn/provabgs.git --upgrade --user !pip install zeus-mcmc --user import numpy as np from provabgs...
github_jupyter
# Human Rights Considered NLP ### **Overview** This notebook creates a training dataset using data sourced from the [Police Brutality 2020 API](https://github.com/2020PB/police-brutality) by adding category labels for types of force and the people involved in incidents using [Snorkel](https://www.snorkel.org/) for NL...
github_jupyter
<a href="https://colab.research.google.com/github/patrickcgray/deep_learning_ecology/blob/master/basic_cnn_minst.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Training a Convolutional Neural Network on the MINST dataset. ### import all necessa...
github_jupyter
**Türkçe için sentiment(duygu) analiz kodu** ``` from google.colab import drive drive.mount('/content/drive') import os os.chdir('./drive/My Drive/') # veriyi pandas ile okuyoruz data = pd.read_csv("sentiment_data.csv") df = data.copy() df.head() #0->negatif veri etiketi #1->pozitif veri etiketi df['Rating'].unique()....
github_jupyter
``` import numpy as np import matplotlib as mpl from matplotlib import pyplot as plt import h5py import tensorflow as tf print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU'))) ``` ## Set Training Label ``` label = 'NewSim_Type2' ``` ## Find all files ``` from glob import glob files_loc = "/gpfs/...
github_jupyter
# Vectors, Matrices, and Arrays # Loading Data ## Loading a Sample Dataset ``` # Load scikit-learn's datasets from sklearn import datasets # Load digit dataset digits = datasets.load_digits() # Create features matrix features = digits.data # Create target matrix target = digits.target # View first observation pri...
github_jupyter
![QuantConnect Logo](https://cdn.quantconnect.com/web/i/logo-small.png) ## Welcome to The QuantConnect Research Page #### Refer to this page for documentation https://www.quantconnect.com/docs#Introduction-to-Jupyter #### Contribute to this template file https://github.com/QuantConnect/Lean/blob/master/Jupyter/BasicQua...
github_jupyter
<a href="https://colab.research.google.com/github/jonkrohn/ML-foundations/blob/master/notebooks/7-algos-and-data-structures.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Algorithms & Data Structures This class, *Algorithms & Data Structures*, i...
github_jupyter
``` import itertools as it import sys import os #if len(sys.argv) != 3: # print("Usage: python3 " + sys.argv[0] + " cluster.xyz" + " mode") # print("mode=1: no cp") # print("mode=2, whole cluster cp") # print("mode=3, individual cluster cp") # sys.exit(1) #fxyz = sys.argv[1] #mode = int(sys.argv[2]) fxy...
github_jupyter
### \*\*\*needs cleaning*** ``` import pandas as pd import numpy as np import sys import os import itertools import time import random #import utils sys.path.insert(0, '../utils/') from utils_preprocess_v3 import * from utils_modeling_v9 import * from utils_plots_v2 import * #sklearn from sklearn.metrics import mea...
github_jupyter
``` import numpy as np import pandas as pd import xarray as xr import zarr import math import glob import pickle import statistics import scipy.stats as stats from sklearn.neighbors import KernelDensity import dask import seaborn as sns import matplotlib.pyplot as plt def getrange(numbers): return max(numbers) - mi...
github_jupyter
# 2D Isostatic gravity inversion - Inverse Problem Este [IPython Notebook](http://ipython.org/videos.html#the-ipython-notebook) utiliza a biblioteca de código aberto [Fatiando a Terra](http://fatiando.org/) ``` %matplotlib inline import numpy as np from scipy.misc import derivative import scipy as spy from scipy impo...
github_jupyter
# **Fraud Detection & Model Evaluation** (SOLUTION) Source: [https://github.com/d-insight/code-bank.git](https://github.com/dsfm-org/code-bank.git) License: [MIT License](https://opensource.org/licenses/MIT). See open source [license](LICENSE) in the Code Bank repository. ------------- ## Overview In this projec...
github_jupyter
## How-to 1. You need to use [modeling.py](modeling.py) from extractive-summarization folder. An improvement BERT model to accept text longer than 512 tokens. ``` import tensorflow as tf import numpy as np import pickle with open('dataset-bert.pkl', 'rb') as fopen: dataset = pickle.load(fopen) dataset.keys() BERT...
github_jupyter
<a href="https://colab.research.google.com/github/GuysBarash/ML_Workshop/blob/main/Bayesian_Agent.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt import m...
github_jupyter
``` %matplotlib inline import pymc3 as pm import numpy as np import scipy.stats as stats import matplotlib.pyplot as plt %config InlineBackend.figure_format = 'retina' plt.style.use(['seaborn-colorblind', 'seaborn-darkgrid']) ``` #### Code 2.1 ``` ways = np.array([0, 3, 8, 9, 0]) ways / ways.sum() ``` #### Code 2.2...
github_jupyter
# Rolling Window Features Following notebook showcases an example workflow of creating rolling window features and building a model to predict which customers will buy in next 4 weeks. This uses dummy sales data but the idea can be implemented on actual sales data and can also be expanded to include other available ...
github_jupyter
# Hyperparameter Tuning using Your Own Keras/Tensorflow Container This notebook shows how to build your own Keras(Tensorflow) container, test it locally using SageMaker Python SDK local mode, and bring it to SageMaker for training, leveraging hyperparameter tuning. The model used for this notebook is a ResNet model,...
github_jupyter
### Scroll Down Below to start from Exercise 8.04 ``` # Removes Warnings import warnings warnings.filterwarnings('ignore') #import the necessary packages import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns ``` ## Reading the data using pandas ``` data= pd.read_csv('Churn_Mode...
github_jupyter
# Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code, but left the implementation of the neural network up to you (for the most part). After you've submitted this project, feel free to explore the data and...
github_jupyter
# ALIGN Tutorial Notebook: DEVIL'S ADVOCATE This notebook provides an introduction to **ALIGN**, a tool for quantifying multi-level linguistic similarity between speakers, using the "Devil's Advocate" transcript data reported in Duran, Paxton, and Fusaroli: "ALIGN: Analyzing Linguistic Interactions with Generalizabl...
github_jupyter
### Install Required Packages ``` ! pip install numpy pandas scikit-learn matplotlib ``` ### Imports ``` import pandas as pd import matplotlib.pyplot as plt import numpy as np from sklearn.pipeline import make_pipeline from sklearn.model_selection import cross_validate from sklearn.decomposition import TruncatedSVD...
github_jupyter
# SETUP ``` !pip install -r requirements_colab.txt -q ``` # DATA > To speed up the review process , i provided the ***drive id*** of the data i've created from the Train creation folder noteboooks . --- > I also add each data drive link in the Readme Pdf file attached with this solution ``` !gdown --id 1hNRbtcqd9F...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') import torch.nn as nn import torch.nn.functional as F import pandas as pd import numpy as np import matplotlib.pyplot as plt import torch import torchvision import torchvision.transforms as transforms from torch.utils.data import Dataset, DataLoader fro...
github_jupyter
# Natural Language Processing - Problems **Author:** Ties de Kok ([Personal Website](https://www.tiesdekok.com)) <br> **Last updated:** June 2021 **Python version:** Python 3.6+ **License:** MIT License **Recommended environment: `researchPython`** ``` import os recommendedEnvironment = 'researchPython' if ...
github_jupyter
# Nearest Neighbors When exploring a large set of documents -- such as Wikipedia, news articles, StackOverflow, etc. -- it can be useful to get a list of related material. To find relevant documents you typically * Decide on a notion of similarity * Find the documents that are most similar In the assignment you will...
github_jupyter
# Azure Cosmos DB Live TV ``` ## Import (?) Client Initialization (??) + Objects Creation ######### NOT NECESSARY!! #from azure.cosmos import CosmosClient #import os #url = os.environ['ACCOUNT_URI'] #key = os.environ['ACCOUNT_KEY'] #client = CosmosClient(url, credential=key) ######### NOT NECESSARY!! db_...
github_jupyter
# Aproximações e Erros de Arredondamento _Prof. Dr. Tito Dias Júnior_ ## **Erros de Arredondamento** ### Épsilon de Máquina ``` #Calcula o épsilon de máquina epsilon = 1 while (epsilon+1)>1: epsilon = epsilon/2 epsilon = 2 * epsilon print(epsilon) ``` Aproximação de uma função por Série de Taylor ``` import n...
github_jupyter
# Shashank V. Sonar ## Task 3: Perform ‘Exploratory Data Analysis’ on dataset ‘SampleSuperstore’ ### ● As a business manager, try to find out the weak areas where you can ### work to make more profit. ### ● What all business problems you can derive by exploring the data? ``` #importing libraries import numpy as...
github_jupyter
# TensorFlow Reproducibility ``` from __future__ import division, print_function, unicode_literals import numpy as np import tensorflow as tf from tensorflow import keras ``` ## Checklist 1. Do not run TensorFlow on the GPU. 2. Beware of multithreading, and make TensorFlow single-threaded. 3. Set all the random see...
github_jupyter
## next_permutation Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order). The replacement must be in-place and use only constant extra ...
github_jupyter
<a href="https://colab.research.google.com/github/partha1189/machine_learning/blob/master/CONV1D_LSTM_time_series.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import tensorflow as tf import numpy as np import matplotlib.pyplot as plt print(tf...
github_jupyter
**This notebook is an exercise in the [Time Series](https://www.kaggle.com/learn/time-series) course. You can reference the tutorial at [this link](https://www.kaggle.com/ryanholbrook/hybrid-models).** --- # Introduction # Run this cell to set everything up! ``` # Setup feedback system from learntools.core import ...
github_jupyter
# Lab 2: Importing and plotting data **Data Science for Biologists** &#8226; University of Washington &#8226; BIOL 419/519 &#8226; Winter 2019 Course design and lecture material by [Bingni Brunton](https://github.com/bwbrunton) and [Kameron Harris](https://github.com/kharris/). Lab design and materials by [Eleanor Lut...
github_jupyter
# Solution for Ex 5 of the ibmqc 2021 This solution is from the point of view from someone who has just started to explore Quantum Computing, but is familiar with the physics behind it and has some experience with programming and optimization problems. So I did not create this solution entirely by myself, but altered...
github_jupyter
``` import numpy as np import theano import theano.tensor as T import lasagne import os #thanks @keskarnitish ``` # Generate names * Struggle to find a name for the variable? Let's see how you'll come up with a name for your son/daughter. Surely no human has expertize over what is a good child name, so let us train NN...
github_jupyter
# Training Models ``` import numpy as np import pandas as pd import os import sys import matplotlib as mpl import matplotlib.pyplot as plt import warnings warnings.filterwarnings(action="ignore", message="^internal gelsd") # Where to save the figures PROJECT_ROOT_DIR = "." CHAPTER_ID = "training_linear_models" IMAGES_...
github_jupyter
## Convolutional Neural Network for MNIST image classficiation ``` import numpy as np # from sklearn.utils.extmath import softmax from matplotlib import pyplot as plt import re from tqdm import trange from sklearn import metrics from sklearn.metrics import accuracy_score from sklearn.metrics import confusion_matrix fr...
github_jupyter
<img src="https://www.ibm.com/watson/health/ai-stories/assets/images/ibm-watson-health-logo.png" style="float: left; width: 40%; margin-bottom: 0.5em;"> ## Develop a neuropathy onset predictive model using the FHIR diabetic patient data (prepared in Notebook 2) **FHIR Dev Day Notebook 3** Author: **Gigi Yuen-Reed** <g...
github_jupyter
# Get Target ``` !pip install -r requirements_colab.txt -q ``` > To speed up the review process , i provided the ***drive id*** of the data i've created from the Train creation folder noteboooks . --- > I also add each data drive link in the Readme Pdf file attached with this solution --- > The data Used in this not...
github_jupyter
# About: 設定ファイルの変更--httpd.conf --- MoodleコンテナのApache HTTPサーバの設定内容を変更します。 ## 概要 設定ファイルを変更する例としてMoodleコンテナのApache HTTPサーバの設定ファイルを編集して、起動時のサーバプロセス数を変更してみます。 ![処理の流れ](images/moodle-032-01.png) 操作手順は以下のようになります。 1. ホスト環境に配置されている設定ファイルをNotebook環境に取得する 2. 取得したファイルのバックアップを作成する 3. Notebookの編集機能を利用して設定ファイルの変更をおこなう 4. 変更した設...
github_jupyter
# HU Extension --- Final Project --- S89A DL for NLP # Michael Lee & Micah Nickerson # PART 2B - ADVERSARIAL ATTACK GENERATOR This is a notebook used to create the different adversarial attack **word perturbations**. ``` adversarial_dir = "Data Sets/adversarial_asap" test_set_file = adversarial_dir+"/v...
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
# About Notebook - [**Kaggle Housing Dataset**](https://www.kaggle.com/ananthreddy/housing) - Implement linear regression using: 1. **Batch** Gradient Descent 2. **Stochastic** Gradient Descent 3. **Mini-batch** Gradient Descent **Note**: _Trying to implement using **PyTorch** instead of numpy_ ``` i...
github_jupyter
# How to handle WelDX files In this notebook we will demonstrate how to create, read, and update ASDF files created by WelDX. All the needed funcationality is contained in a single class named `WeldxFile`. We are going to show different modes of operation, like working with physical files on your harddrive, and in-memo...
github_jupyter
``` import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import os import os.path as path import itertools from sklearn.model_selection import train_test_split import tensorflow as tf import tensorflow.keras as keras from tensorflow.keras.layers import Input,InputLayer, Dense, Activation, BatchNor...
github_jupyter
# This is the EDA file ## The Main Findings I found were as follows 1. The Main Table in the database is "Results" Table 2. There are 28 columns in total in the "Results" Table 3. There are total 17 ID columns where each ID column referes to some other table in database 4. Row number 46360 contains ...
github_jupyter
# Gaussian Mixture Model with ADVI Here, we describe how to use ADVI for inference of Gaussian mixture model. First, we will show that inference with ADVI does not need to modify the stochastic model, just call a function. Then, we will show how to use mini-batch, which is useful for large dataset. In this case, where...
github_jupyter
# EXAMPLE: Personal Workout Tracking Data This Notebook provides an example on how to import data downloaded from a specific service Apple Health. NOTE: This is still a work-in-progress. # Dependencies and Libraries ``` from datetime import date, datetime as dt, timedelta as td import pytz import numpy as np import...
github_jupyter
<a href="https://colab.research.google.com/github/wisrovi/pyimagesearch-buy/blob/main/skin_detection.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ![logo_jupyter.png](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAABcCAYAAABA4uO3AAAAAXNSR0IArs...
github_jupyter
# Granger Causality with Google Trends - Did `itaewon class` cause `โคชูจัง`? We will give an example of Granger casuality test with interests over time of `itaewon class` and `โคชูจัง` in Thailand during 2020-01 to 2020-04. During the time, gochujang went out of stock in many supermarkets supposedly because people mi...
github_jupyter
# CAM Methods Benchmark **Goal:** to compare CAM methods using regular explaining metrics. **Author:** lucas.david@ic.unicamp.br Use GPUs if you are running *Score-CAM* or *Quantitative Results* sections. ``` #@title from google.colab import drive drive.mount('/content/drive') import tensorflow as tf # base_dir...
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
## Facial keypoints detection In this task you will create facial keypoint detector based on CNN regressor. ![title](example.png) ### Load and preprocess data Script `get_data.py` unpacks data — images and labelled points. 6000 images are located in `images` folder and keypoint coordinates are in `gt.csv` file. Ru...
github_jupyter
``` import os import math import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline ``` ### Немного о ресурсах в Spark Spark управляет ресурсами через Driver, а ресурсы - распределенные Executors. ![](cwrMN.png) `Executor` это рабочий процесс, который запускает индивидуа...
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
# Dynamic factors and coincident indices Factor models generally try to find a small number of unobserved "factors" that influence a subtantial portion of the variation in a larger number of observed variables, and they are related to dimension-reduction techniques such as principal components analysis. Dynamic factor...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # AutoML 02: Regression with local compute In this example we use the scikit learn's [diabetes dataset](http://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_diabetes.html) to showcase how you can use AutoML fo...
github_jupyter
# Линейная регрессия https://jakevdp.github.io/PythonDataScienceHandbook/ полезная книга которую я забыл добавить в прошлый раз # План на сегодня: 1. Как различать различные решения задачи регрессии? 2. Как подбирать параметры Линейной модели? 3. Как восстанавливать нелинейные модели с помощью Линейной модели? 4. ...
github_jupyter
``` import numpy as np from pandas import Series, DataFrame import pandas as pd from sklearn import preprocessing, tree from sklearn.metrics import accuracy_score # from sklearn.model_selection import train_test_split, KFold from sklearn.neighbors import KNeighborsClassifier from sklearn.cross_validation import KFold d...
github_jupyter
# Koopman Training and Validation for 2D Tail-Actuated Robotic Fish This file uses experimental measurements using a 2D Tail-Actuated Robotic Fish to train an approximate Koopman operator. Using the initial conditions of each experiment, the data-driven solution is then used to predict the system forward and compared ...
github_jupyter
``` import pandas as pd import numpy as np from datascience import * # Table.interactive() import matplotlib # from ipywidgets import interact, Dropdown %matplotlib inline import matplotlib.pyplot as plt import numpy as np plt.style.use('fivethirtyeight') ``` # Project 2: Topic ## Table of Contents <a href='#sect...
github_jupyter
# 解方程 ## 简单的一元一次方程 \begin{equation}x + 16 = -25\end{equation} \begin{equation}x + 16 - 16 = -25 - 16\end{equation} \begin{equation}x = -25 - 16\end{equation} \begin{equation}x = -41\end{equation} ``` x = -41 # 验证方程的解 x + 16 == -25 ``` ## 带系数的方程 \begin{equation}3x - 2 = 10 \end{equation} \beg...
github_jupyter
# Introduction to Seaborn *** We got a good a glimpse of the data. But that's the thing with Data Science the more you get involved the harder is it for you to stop exploring. Now, We want to **analyze** the data in order to extract some insights.We can use the Seaborn library for that. We can use Seaborn to do both...
github_jupyter
# Scaling up ML using Cloud AI Platform In this notebook, we take a previously developed TensorFlow model to predict taxifare rides and package it up so that it can be run in Cloud AI Platform. For now, we'll run this on a small dataset. The model that was developed is rather simplistic, and therefore, the accuracy of...
github_jupyter
``` import spacy from IPython.display import SVG, YouTubeVideo from spacy import displacy ``` # Intro to Clinical NLP ### Instructor: Alec Chapman ### Email: abchapman93@gmail.com Welcome to the NLP module! We'll start this module by watching a short introduction of the instructor and of Natural Language Processing ...
github_jupyter
# Pre-trained embeddings for Text ``` import gzip import numpy as np %matplotlib inline import matplotlib.pyplot as plt import pandas as pd glove_path = '../data/embeddings/glove.6B.50d.txt.gz' with gzip.open(glove_path, 'r') as fin: line = fin.readline().decode('utf-8') line def parse_line(line): values = lin...
github_jupyter
<div class="alert alert-info"> Launch in Binder [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/esowc/UNSEEN-open/master?filepath=doc%2FNotebooks%2Fexamples%2FCalifornia_Fires.ipynb) <!-- Or launch an [Rstudio instance](https://mybinder.org/v2/gh/esowc/UNSEEN-open/master?urlpath=rstudi...
github_jupyter
# Handwritten Digit Detection #### Helia Rasooli #### Zahra Bakhtiar #### Bahareh Behroozi #### Seyyedeh Zahra Fallah MirMousavi Ajdad # MNIST #### The MNIST database of handwritten digits, available from this page, has a training set of 60,000 examples, and a test set of 10,000 examples. It is a subset of a larger se...
github_jupyter
``` ######################################CONSTANTS###################################### METRIC = 'calibration_error' MODE = 'max' HOLDOUT_RATIO = 0.1 RUNS = 100 LOG_FREQ = 100 threshold = 0.98 # threshold for x-axis cutoff COLOR = {'non-active_no_prior': '#1f77b4', 'ts_uniform': 'red',#'#ff7f0e', ...
github_jupyter
``` import os os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"; # The GPU id to use, usually either "0" or "1"; os.environ["CUDA_VISIBLE_DEVICES"]="1"; import numpy as np import tensorflow as tf import random as rn # The below is necessary for starting Numpy generated random numbers # in a well-defined initial state. n...
github_jupyter
# Full-time Scores in the Premier League ``` import pandas as pd import numpy as np df = pd.read_csv("../data/fivethirtyeight/spi_matches.csv") # df = df[(df['league_id'] == 2412) | (df['league_id'] == 2411)] df = df[df['league_id'] == 2411] df = df[["season", "league_id", "team1", "team2", "score1", "score2", "date"...
github_jupyter
``` !pip install exetera # Copyright 2020 KCL-BMEIS - King's College London # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # Model Development with Custom Weights This example shows how to retrain a model with custom weights and fine-tune the model with quantization, then deploy the model running on FPGA. Only Windows is supported. We use TensorFlo...
github_jupyter
``` import draftfast import pandas as pd df=pd.read_csv('full_old_NFL.csv') del df['Unnamed: 0'] from draftfast import rules from draftfast.optimize import run, run_multi from draftfast.orm import Player from draftfast.csv_parse import salary_download df = df.dropna() # for year, week in zip(df['Year'], df['Week']): # ...
github_jupyter
# The Rise of GitHub GitHub has become the dominant channel that development teams use to collaborate on code. Wikipedia's [Timeline of GitHub](https://en.wikipedia.org/wiki/Timeline_of_GitHub) documents GitHub's rise to dominance as a *business*. We will use a `mirror` crawl to analyze GitHub's rise as a *platform*. ...
github_jupyter
# Lista 02 - Probabilidade + Estatística ``` import matplotlib.pyplot as plt import numpy as np import pandas as pd from numpy.testing import * from scipy import stats as ss plt.style.use('seaborn-colorblind') plt.ion() ``` # Exercício 01: Suponha que a altura de mulheres adultas de algumas regiões seguem uma dis...
github_jupyter
This notebook is part of https://github.com/AudioSceneDescriptionFormat/splines, see also https://splines.readthedocs.io/. [back to rotation splines](index.ipynb) # Barry--Goldman Algorithm We can try to use the [Barry--Goldman algorithm for non-uniform Euclidean Catmull--Rom splines](../euclidean/catmull-rom-barry-...
github_jupyter
``` from urllib.request import urlopen from bs4 import BeautifulSoup def getNgrams(content, n): content = content.split(' ') output = [] for i in range(len(content)-n+1): output.append(content[i:i+n]) return output html = urlopen('http://en.wikipedia.org/wiki/Python_(programming_language)') bs = Beautiful...
github_jupyter
# Stroop effect investigation [Cédric Campguilhem](https://github.com/ccampguilhem/Udacity-DataAnalyst), September 2017 <a id='Top'/> ## Table of contents - [Introduction](#Introduction) - [Stroop effect experiment](#Stroop effect experiment) - [Descriptive statistics](#Descriptive statistics) - [Inferential statist...
github_jupyter
# Kotelite dataset maker **Kotlite** (Angkot Elite) is an application that allows drivers to get passengers who have the same lane. This application is expected to parse existing congestion using the concept of ridesharing, in which passengers will get the experience of driving using a private car or taxi, but get a f...
github_jupyter
# Language Translation In this project, you’re going to take a peek into the realm of neural network machine translation. You’ll be training a sequence to sequence model on a dataset of English and French sentences that can translate new sentences from English to French. ## Get the Data Since translating the whole lan...
github_jupyter