text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
```
import math
import sys,os
import numpy as np
import pandas as pd
from mgwr.gwr import GWR,GWRResults
from mgwr.sel_bw import Sel_BW
zillow = pd.read_csv("Zillow-test-dataset/zillow_5k.csv",sep=',')
zillow.head()
#Converting things into matrices
y = zillow.value.values.reshape(-1,1)
X = zillow.iloc[:,3:].values
k =... | github_jupyter |
## 1. Setup
```
import sys
sys.path.append('../../..')
import matplotlib.pyplot as plt
import warnings
from experiments.experiment_utils import *
%matplotlib inline
%load_ext autoreload
%autoreload 2
warnings.filterwarnings('ignore')
```
## 2. Experiment stats
- Architecture: FCRN-A;
- Train size: (32 vs 64);
- Bat... | github_jupyter |
```
pip install pytorch_lightning --quiet
import os
import json
import pickle
import nltk
from PIL import Image
import torch
import torch.utils.data as data
import torchvision.transforms as transforms
import pytorch_lightning as pl
from model import HybridModel
from vocabulary import Vocabulary
nltk.download('punkt'... | github_jupyter |
# Finetuning for Text Generation
> Look at the Getting Started with Finetuning notebook for a more in-depth version.
One of the tasks that Backprop supports right out of the box is question answering based on context.
What if instead you wanted to do the reverse? That is generate questions based on context. That's c... | github_jupyter |
## Udacity Data Engineering Capstone Project
### Setup
```
import boto3
import pandas as pd
from pathlib import Path
from configparser import ConfigParser
root_path = Path().home().joinpath("/home/vineeth/Work/Extras/Capstone Project/")
data_path = root_path.joinpath("data")
config = ConfigParser()
config.read(root_p... | github_jupyter |
```
import rdkit.Chem as Chem
import rdkit.Chem.Crippen as Crippen
import rdkit.Chem.Lipinski as Lipinski
import rdkit.Chem.rdMolDescriptors as MolDescriptors
import rdkit.Chem.Descriptors as Descriptors
import rdkit.Chem.Fragments as Fragments
import inspect
import numpy as np
import glob
import os
import pandas as pd... | github_jupyter |
# Linear Regression
In this tutorial, we are going to demonstrate how to use the `abess` package to carry out best subset selection
in linear regression with both simulated data and real data.
## Linear Regression
Our package `abess` implement a polynomial algorithm in the for best-subset selection problem:
$$
\mi... | github_jupyter |
# Deep Recommender: Item Representation Learning Using Node2Vec
In this notebook, we build a non-personalized graph recommendation engine that uses Node2Vec model to learn item embeddings. This notebook is based on Khalid Salama's implementation [1].
### Data
We use `MovieLens 100K` (Latest Small version) dataset. S... | github_jupyter |
# Ridge, LASSO, and Elastic Net Regression
```
import numpy as np
np.random.seed(1)
```
### Dataset and prep
```
from sklearn.datasets import load_boston
boston = load_boston()
print(boston.feature_names)
print()
print(type(boston.feature_names))
print()
print(len(boston.feature_names))
print(boston.data)
print()
p... | github_jupyter |
<a id="title_ID"></a>
# JWST Pipeline Validation Notebook: calwebb_image3, NIRCam imaging
<span style="color:red"> **Instruments Affected**</span>: e.g., NIRCam
### Table of Contents
<div style="text-align: left">
<br> [Introduction\*](#intro)
<br> [JWST CalWG Algorithm\*](#algorithm)
<br> [Defining Terms](#t... | github_jupyter |
<small><small><i>
All the IPython Notebooks in **Python Files** lecture series by **[Dr. Milaan Parmar](https://www.linkedin.com/in/milaanparmar/)** are available @ **[GitHub](https://github.com/milaan9/05_Python_Files)**
</i></small></small>
# Python Directory and Files Management
In this class, you'll learn about f... | github_jupyter |
```
import pandas as pd
import matplotlib.pylab as plt
import numpy as np
import seaborn as sns
from tqdm.auto import tqdm
tqdm.pandas()
%matplotlib inline
pd.set_option("display.max_rows", 1000)
data = pd.read_csv("uiks-utf8.csv")
data.head()
```
## Сумма голосов за/против
```
print(f"{data.yes_votes.sum()} Голосо... | github_jupyter |
# Working with Time Series in Pandas
> A Summary of lecture "Manipulating Time Series Data in Python", via datacamp
- toc: true
- badges: true
- comments: true
- author: Chanseok Kang
- categories: [Python, Datacamp, Time_Series_Analysis]
- image: images/google_lagged.png
```
import pandas as pd
import numpy as np
i... | github_jupyter |
# SVM Regression
This function shows how to use TensorFlow to solve support vector regression. We are going
to find the line that has the maximum margin which INCLUDES as many points as possible.
We will use the iris data, specifically:
$y =$ Sepal Length
$x =$ Pedal Width
To start, load the necessary libraries:
... | github_jupyter |
# T81-558: Applications of Deep Neural Networks
**Module 3: Introduction to TensorFlow**
* Instructor: [Jeff Heaton](https://sites.wustl.edu/jeffheaton/), McKelvey School of Engineering, [Washington University in St. Louis](https://engineering.wustl.edu/Programs/Pages/default.aspx)
* For more information visit the [cla... | github_jupyter |
```
import time
import itertools
import math
import datetime
import pynmea2
import serial
import pandas as pd
import matplotlib.pyplot as plt
file_path = '../../DATA/EXP1/IOT/logfile.txt'
def read2df(filename):
iot_data = {'time':[], 'latitude':[], 'latitude direction':[], 'longitude':[], 'longitude direction':[], ... | github_jupyter |
# Predição de COVID-19 em Raio-X Pulmonar
Neste trabalho, vamos desenvolver um modelo para classificação de Raio-X pulmonares de pessoas saudáveis e de pessoas que estão ou já tiveram contato com o novo coronavírus.
A escolha do tópico veio devido a necessidade de achar novos caminhos para o reconhecimento de casos d... | github_jupyter |
#4th-order quadrature example
Ported from the MATLAB file `dsexample4.m`, written by R. Schreier.
Preliminary code to set-up IPython:
```
from __future__ import division
%matplotlib inline
import numpy as np
from pylab import *
```
Import the `deltasigma` module.
```
import deltasigma as ds
```
## ADC specificati... | github_jupyter |
# Use linear transforms between successive frames to straighten video
```
%load_ext autoreload
%autoreload 2
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from scipy.ndimage import affine_transform
from scipy.stats import multivariate_normal
from scipy.io import loadmat
from otimage import re... | github_jupyter |
# SGDClassifier with RobustScaler & PolynomialFeatures
This Code template is for the Classification tasks using the simple SGDClassifier based on the Stochastic Gradient Descent with RobustScaler as Feature Rescaling technique PolynomialFeatures as Feature Transformation Technique in a pipeline.
### Required Packages... | github_jupyter |
# HnswLib Quick Start
[](https://colab.research.google.com/github/jelmerk/hnswlib/blob/master/hnswlib-examples/hnswlib-examples-pyspark-google-colab/quick_start_google_colab.ipynb)
We will first set up the runtime environment and give it a qui... | github_jupyter |
## 準備
依存関係をインストールします
```
!pip install -U pip
!pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
!pip install transformers["ja"] numpy pandas sentencepiece
```
## 学習データのダウンロード
今回は株式会社リクルートが提供する"Japanese Realistic Textual Entailment Corpus" ... | github_jupyter |
## This notebook measures Tribuo Hdbscan performance with the Gaussian 100000 data
```
%jars ../../../jars/junit-jupiter-api-5.7.0.jar
%jars ../../../jars/opentest4j-1.2.0.jar
%jars ../../../jars/junit-platform-commons-1.7.1.jar
%jars ../../../jars/tribuo-clustering-hdbscan-4.2.0-SNAPSHOT-jar-with-dependencies.jar
imp... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
%matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.cluster import KMeans
from sklearn.svm import SVC
from sklearn.metrics import roc_auc_score, roc_curve
from sklearn import preprocessing
from sklearn.linear_model import Log... | github_jupyter |
<p style="font-size:32px;text-align:center"> <b>Social network Graph Link Prediction - Facebook Challenge</b> </p>
### Problem statement:
Given a directed social graph, have to predict missing links to recommend users (Link Prediction in graph)
### Data Overview
Taken data from facebook's recruting challenge on kagg... | github_jupyter |
# Lab 01 - Local Optimization
## Tasks
- Introduction to PyTorch - will be used throughout the course
- Introduction to autograd
- Implement gradient descent using autograd framework
- Optimize a simple quadrupole triplet
## Set up environment
```
!pip install git+https://github.com/uspas/2021_optimization_and_ml --q... | github_jupyter |
# Homework 07
### Preparation...
Run this code from the lecture to be ready for the exercises below!
```
import glob
import os.path
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import datasets, linear_model, ensemble, neural_network
from sklearn.metrics import mean_squared_e... | github_jupyter |
```
import numpy as np
import pandas as pd
from matplotlib import pyplot
%matplotlib inline
filename = 'housing.csv'
names = ['CRIM', 'ZN', 'INDUS', 'CHAS', 'NOX', 'RM', 'AGE', 'DIS', 'RAD', 'TAX', 'PRTATIO', 'B', 'LSTAT', 'MEDV']
df = pd.read_csv(filename, names=names, sep='\s+')
df.shape
pd.set_option('precision', 1... | github_jupyter |
```
import pandas as pd
import numpy as np
import altair as alt
%matplotlib inline
pd.set_option('display.max_colwidth', None)
```
## Gantt chart 04-13-2020
```
df_200413 = pd.read_excel("./GanttChart_data.xlsx", sheet_name='200413')
df_200413
df = df_200413
df["Start Date"] = pd.to_datetime(df["Start Date"], )
df["E... | github_jupyter |
## 範例重點
* 了解如何在 Keras 中,加入 regularization
* 熟悉建立、訓練模型
* 熟悉將訓練結果視覺化並比較結果
```
import os
from tensorflow import keras
# 本範例不需使用 GPU, 將 GPU 設定為 "無"
os.environ["CUDA_VISIBLE_DEVICES"] = ""
# 從 Keras 的內建功能中,取得 train 與 test 資料集
train, test = keras.datasets.cifar10.load_data()
## 資料前處理
def preproc_x(x, flatten=True):
x =... | github_jupyter |
```
import pandas as pd
import numpy as np
from sklearn import linear_model
from sklearn import preprocessing
from sklearn import svm
from sklearn.model_selection import train_test_split
from sklearn.feature_selection import VarianceThreshold
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from mp... | github_jupyter |
<a href="https://colab.research.google.com/github/sachalapins/U-GPD/blob/main/2_UGPD_run.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Running U-GPD Transfer Learning Model on Data from Nabro Volcano
Last updated 28th Jul 2021.
___
The code in... | github_jupyter |
# Practical 8: Pandas to Cluster Analysis
<div class="alert alert-block alert-success">
<b>Objectives:</b> In this practical we keep moving with applied demonstrations of modules you can use in Python. Today we continue to practice using Pandas, but also start applying some common machine learning techniques. Specific... | github_jupyter |
# V-polyhedral disjunctive cuts plotting worksheet
1. Table 1: Summary statistics for percent gap closed by VPCs --- avg (%) and number of strict wins (best by at least `EPS`), including set of all instances and set of ≥ 10% gap closed instances
2. Table 2: Average percent gap closed by num disj terms
3. Table 3: Summa... | github_jupyter |
## <font color='green'>Movielens - Singular Value Decomposition (Sparse Matrix)<font>
### <font color='green'> 1. Description<font>
Recommendation using singular value decomposition.
The data is taken from: https://grouplens.org/datasets/movielens/25m/
It contains 25 million ratings and one million tag applications ... | github_jupyter |
# Results for GDF+PCA+LSTM
Here we present results for the best LSTMs choosen based on best MCC (matthews) score on validation set.
The features for LSTMs are GDFs reduced by PCA (number of components is chosen based on sum of explained variance ratio > 0.99).
Because LSTMs are not deterministic, the scores may vary... | github_jupyter |
# Object Detection Demo
Welcome to the object detection inference walkthrough! This notebook will walk you step by step through the process of using a pre-trained model to detect objects in an image.
# Imports
```
import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorf... | github_jupyter |
## Python security RAPIDS GPU & graph one-liners: Index
All GPU Python data science tutorials: [RAPIDS Academy github](https://github.com/RAPIDSAcademy/rapidsacademy)
**Contributors**
* [Leo Meyerovich](https://twitter.com/lmeyerov) ([Graphistry](https://www.graphistry.com))
* We started using Jupyter for secur... | github_jupyter |
Tested single data split only, not cross validation applied.
And results are not very consistent, vary with each run...
### Polarity classification
INFO:tensorflow:***** Eval results *****
INFO:tensorflow: eval_accuracy = 0.8264151
INFO:tensorflow: eval_loss = 0.4085315
INFO:tensorflow: global_ste... | github_jupyter |
Setting up the simulated dataset and fwd/bwd projecting.
This demo is a jupyter notebook, i.e. intended to be run step by step.
Author: Imraj Singh
First version: 20th of May 2022
CCP SyneRBI Synergistic Image Reconstruction Framework (SIRF).
Copyright 2022 University College London.
This is software developed for... | github_jupyter |
# Matplotlib Advanced - Bells & Whistles
#### Review and Outline
Great Work! We now know how to create graphs via the two standard approaches, and some basic graph options, but if we're honest with ourselves we'd admit they're far from enough.
In fact, we just got started. We have a huge number of methods availa... | github_jupyter |
# Importinng and loading the csv file
```
import numpy as np
import pandas as pd
url = 'https://raw.githubusercontent.com/RidhaMoosa/eskom_data-/master/electrification_by_province.csv'
ebp = pd.read_csv(url)
for col, row in ebp.iloc[:,1:].iteritems():
ebp[col] = ebp[col].str.replace(',','').astype(int)
limpopo ... | github_jupyter |
In this notebook, I will publish some code examples for training AlexNet, using Keras and Theano.
**Software Requirements :- **
1. Theano - Follow the instructions available here http://deeplearning.net/software/theano/install.html#install
2. Keras - Follow the instructions available here https://keras.io/#installatio... | github_jupyter |
Taking the g_train dataset (NB Test_Step_4, random seed 200, 80% of total dataset) and creating a stopwords list covering all music, and then three sets of words unique to each genre (Rock, Pop, Hip Hop).
This is a unique, nonproduction, lots-of-touch-labor kind of an operation. Not putting together a code block for ... | 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 |
# Introducing the JASMIN Notebook Service
In this Notebook, we will discuss:
1. What is a Notebook?
2. Using Python in the browser
3. Plotting in a Notebook
4. Working with data in the CEDA Archive
5. Accessing data in Group Workspaces
6. Creating virtual environments to install additional software
7. Sharing Notebo... | github_jupyter |
$$
\def\CC{\bf C}
\def\QQ{\bf Q}
\def\RR{\bf R}
\def\ZZ{\bf Z}
\def\NN{\bf N}
$$
# Tutorial
```
import komoog.komoot as komoot
import komoog.audio as audio
import matplotlib.pyplot as pl
```
## Download komoot tours
```
tours = komoot.download_all_komoot_tours()
for i, tour in enumerate(tours):
print(i, tour['na... | github_jupyter |
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Backbone-Activation" data-toc-modified-id="Backbone-Activation-1"><span class="toc-item-num">1 </span>Backbone Activation</a></span></li><li><span><a href="#Tucodec-activation" data-toc-modified-... | github_jupyter |
# Change Detection Example: Log Ratio
This example shows how the Capella API can be used to fetch a time series stack of data, read data for a given bounding box directly from cloud optimized geotiffs stored in Capella's S3 bucket, and apply a log ratio change detection with an accumulator. To run this notebook, you w... | github_jupyter |
<a href="https://colab.research.google.com/github/scancer-org/ml-pcam-classification/blob/main/notebooks/08_Fix_NaN_issue_in_division_cleaning_code_2021_05_01.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# [PCAM Classification](https://github.com... | github_jupyter |
```
import sys
import os
# getting the name of the directory
# where the this file is present.
current = os.path.abspath('')
# Getting the parent directory name
# where the current directory is present.
parent = os.path.dirname(current)
sys.path.append(parent)
from parameters import *
```
### Generate regular rando... | github_jupyter |
# Symbolic Filtering
This notebook contains the symbolic computations left out in *(Zander et al 2020)*. First we load the necessary packages.
```
from sympy import *
from sympy.physics.quantum.dagger import Dagger
#from sympy.matrices import Matrix, PermutationMatrix
#from sympy.combinatorics import Permutation
#impo... | github_jupyter |
# How TorchCox works
```
import pandas as pd
import torch
from torch import nn
from torch import optim
import numpy as np
torch.autograd.set_detect_anomaly(True)
```
The first step is to get our survival data in the right format, which is the staircase encoding described in `notebooks/Staircase_encoding.ipynb`
```
... | github_jupyter |
Create spark session
```
import sys, glob, os
SPARK_HOME = "/Users/abulbasar/Downloads/spark-2.3.1-bin-hadoop2.7"
sys.path.append(SPARK_HOME + "/python")
sys.path.append(glob.glob(SPARK_HOME + "/python/lib/py4j*.zip")[0])
from pyspark.sql import SparkSession, functions as F
spark = (SparkSession
.builder
... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import time
import math
import gc
from sklearn.preprocessing import MinMaxScaler
import feather
import tensorflow as tf
import tensorflow.keras as k
import tensorflow.keras.backend as tfb
from tcn import TCN
tf.config.set_soft_device_placement... | github_jupyter |
# Final exam
**For this exam, feel free to re-use any code from the previous lab notebooks.**
#### Tasks
- Use accelerator data to construct a neural network surrogate model, train that model, and demonstrate that it accurately models the data
- Use Bayesian optimization to optimize the function and determine the bes... | github_jupyter |
```
%matplotlib inline
import pandas as pd
from IPython.core.display import HTML
css = open('style-table.css').read() + open('style-notebook.css').read()
HTML('<style>{}</style>'.format(css))
titles = pd.DataFrame.from_csv('data/titles.csv', index_col=None)
titles.head()
cast = pd.DataFrame.from_csv('data/cast.csv', in... | 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 |
# Example Notebook with Edge Detection
The following notebook will walk you through the analysis of a 48-well wellplate containing 24 samples of Candelilla Wax and the remaining Xylitol samples.
#### Import the necessary packages
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from phasIR ... | github_jupyter |
# Jouer avec les mots
Les mots utilisés dans ce chapitre sont des mots français pour le Scrabble de Jean-Philippe Durand, disponible sous http://jph.durand.free.fr/scrabble.txt
## Lire des listes de mots
```
fin = open('mots.txt')
```
Le premier mot est *AA* qui est une sorte de lave. Les mots se terminent par le c... | github_jupyter |
<h1 style="text-align:center;">A Neuronal Model for the Startle Response in Fish schools</h1>
<br />
<br />
<center>
Andrej Warkentin<br />
Supervisor: Pawel Romanczuk<br />
Lab rotation presentation<br />
30.11.2017<br />
</center>
```
%%html
<style>
.example
{
float:left;
width: 33%;
height: 80%;
t... | github_jupyter |
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content-dl/blob/main/tutorials/W1D1_BasicsAndPytorch/W1D1_Tutorial1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <a href="https://kaggle.com/kernels/welcome?src=http... | github_jupyter |
# Simulation models that include scheduling
Many health systems include a **scheduling** function. This might for example be the scheduling of patient operations or appointments. These systems are also queuing systems, but differ slightly from the systems we have already explored. These models will need a **diary**... | github_jupyter |
<table style="width:100%; border: 0px solid black;">
<tr style="width: 100%; border: 0px solid black;">
<td style="width:75%; border: 0px solid black;">
<a href="http://www.drivendata.org">
<img src="https://s3.amazonaws.com/drivendata.org/kif-example/img/dd.png" />
<... | github_jupyter |
# File Reader - Global Fireball Exchange (GFE) Standard
This notebook reads a single-station meteor observation in the standardised GFE format and prints it to screen item-by-item. It will prompt for an input file in GFE format, i.e. having the file extension ".ecsv".
This script was originated by and is maintained b... | github_jupyter |
# PSF Generation Validation Template
### Parameters
```
# Debug
# psf_args = '{"pz": 0}'
# Parameters
psf_args = None
# Parameters
psf_args = "{\"pz\": 0.0, \"res_axial\": 1.5, \"num_samples\": 2000}"
# Parse parameters
import json
psf_args = json.loads(psf_args)
psf_args
```
### Initialize
```
%run utils.py
import... | github_jupyter |
# Q-learning for Taxi Problem
### Taxi problem
```
Map "+---------+",
"|R: | : :G|",
"| : | : : |",
"| : : : : |",
"| | : | : |",
"|Y| : |B: |",
"+---------+",
```
Passenger locations:
- 0: R(ed)
- 1: G(reen)
- 2: Y(ellow)
- 3: B(lue)
- 4: in taxi
Destinations:
- 0: R(ed)
- 1: ... | github_jupyter |
```
from u import *
from ut import *
from data import *
import quantized_model
from quantized_model import evaluate, get_net
quantized_model.distiller_vs_explicit = 'explicit' # switch off using distiller, which we use during quantization aware training
os.environ['CUDA_VISIBLE_DEVICES'] = '3'
num_bits = 8
# load in h... | github_jupyter |
```
import pymc as pm
import numpy as np
import arviz as az
%load_ext lab_black
%load_ext watermark
```
# Gesell
This example demonstrates ...
Adapted from [unit 9: Gesell.odc](https://raw.githubusercontent.com/areding/6420-pymc/main/original_examples/Codes4Unit9/Gesell.odc).
Note: not really working right now. ... | github_jupyter |
```
import os
import cv2
import numpy as np
import random
# To make sure that augmented images is not generated from validation object/background
VALIDATION_PATH = r'D:\Resources\Inat_Partial\Aves_Small_SS1_Validation\CV_0'
#OBJECT_PATH = r'D:\Resources\Inat_Partial\Aves_Small_SS1_Object'
OBJECT_PATH = r'D:\Resources\... | github_jupyter |
# Importing Important Libraries
```
%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow import keras
print(tf.__version__)
print(keras.__version__)
```
### USING KERAS TO LOAD THE DATASET
```
fashion_mnist = keras.datasets.fashion_mnist
... | github_jupyter |
# Census- Employment Status Data
```
import pandas as pd
import requests
#Census Subject Table API for Employment Status data within Unified School Districts in California for 2018
url="https://api.census.gov/data/2018/acs/acs1/subject?get=group(S2301)&for=school%20district%20(unified)&in=state:06"
#Request for HTTP D... | github_jupyter |
```
import pandas as pd
import server.dao as dao
import matplotlib.pyplot as plt
from wordcloud import WordCloud
import numpy as np
from tqdm import tqdm_notebook as tqdm
import jieba
import jieba.analyse
import snownlp
import re
import jiagu
import random
import datetime
from collections import Counter
# 支持中文
plt.rcP... | github_jupyter |
```
%matplotlib inline
```
# Multiclass sparse logisitic regression on newgroups20
Comparison of multinomial logistic L1 vs one-versus-rest L1 logistic regression
to classify documents from the newgroups20 dataset. Multinomial logistic
regression yields more accurate results and is faster to train on the larger
sca... | github_jupyter |
# WARNING: This notebook is still under contruction
```
import os, pickle, time
import numpy as np
import healpy as hp
from beamconv import ScanStrategy, tools
import matplotlib.pyplot as plt
import qpoint as qp
import seaborn as sns
sns.set()
%matplotlib inline
def get_cls(fname='../ancillary/wmap7_r0p03_lensed_uK_ex... | github_jupyter |
```
!pip install pytorch-lightning==1.2.3 --quiet
!pip install transformers==3.0.0 --quiet
import torch
from torch import nn, optim
from torch.utils.data import DataLoader
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
import matplotlib.pyplot as plt
%matplotlib inline
import p... | github_jupyter |
```
import re
import csv
import pandas
import sqlite3
import random
import json
import itertools
import numpy as np
from sumeval.metrics.rouge import RougeCalculator
rouge = RougeCalculator(stopwords=False, lang="en")
from utils import *
db_file = 'mimic_db/mimic.db'
model = query(db_file)
(db_meta, db_tabs, db_head) ... | github_jupyter |
## Stacking Classifier
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.colors import ListedColormap
import matplotlib.patches as mpatches
from sklearn.svm import LinearSVC
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing imp... | github_jupyter |
```
%pylab inline
import galsim
gal_flux = 1.e5 # counts
gal_r0 = 2.7 # arcsec
g1 = 0.1 #
g2 = 0.2 #
pixel_scale = 0.2 # arcsec / pixel
psf_beta = 5 #
psf_re = 1.0 # arcsec
# Define the galaxy profile.
gal = galsim.Exponential(flux=gal_flux, scale_radius=gal_r0)
# To make s... | github_jupyter |
<a href='http://www.holoviews.org'><img src="assets/hv+bk.png" alt="HV+BK logos" width="40%;" align="left"/></a>
<div style="float:right;"><h2>01. Introduction to Elements</h2></div>
## Preliminaries
If the ``hvtutorial`` environment has been correctly created and activated using the instructions listed on the [welc... | github_jupyter |
# RNA-seq Calling
This pipeline aims to call the RNA-seq data from original `fastq.gz` data. It implements the GTEx pipeline for GTEx / TOPMed project. Please refer to [this page](https://github.com/broadinstitute/gtex-pipeline/blob/master/TOPMed_RNAseq_pipeline.md) for detail.
**Various reference data needs to be p... | github_jupyter |
<a href="https://colab.research.google.com/github/krakowiakpawel9/uczenie_maszynowe/blob/master/decision_trees/classification/05_decision_tree_implementation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
* @author: krakowiakpawel9@gmail.com
* @s... | github_jupyter |
this is folk of the1owls's "Ridge & Huber - 3 Pointer (M)" with Japanese caption.
https://www.kaggle.com/the1owl/ridge-huber-3-pointer-m
just for my understanding
```
# ライブラリを読み込む
import pandas as pd
import numpy as np
from sklearn import *
import os, glob
# データを読み込む
datafiles = sorted(glob.glob('../input/**.csv'... | github_jupyter |
```
import numpy as np
import pandas as pd
from sklearn.metrics import accuracy_score
from sklearn.metrics import confusion_matrix
import statsmodels.api as sm
import warnings
warnings.filterwarnings("ignore")
acc_cas = {}
for i in range(2012, 2017):
idx = str(i)
acc = pd.read_excel('./input/{0}/Acc_cas {0}.xls... | github_jupyter |
# Sentiment Analysis
## Introduction
So far, all of the analysis we've done has been pretty generic - looking at counts, creating scatter plots, etc. These techniques could be applied to numeric data as well.
When it comes to text data, there are a few popular techniques that we'll be going through in the next few n... | github_jupyter |
# Autonomous driving - Car detection
Welcome to your week 3 programming assignment. You will learn about object detection using the very powerful YOLO model. Many of the ideas in this notebook are described in the two YOLO papers: Redmon et al., 2016 (https://arxiv.org/abs/1506.02640) and Redmon and Farhadi, 2016 (htt... | github_jupyter |
# Image Classification
In this tutorial, we show you how to start with an image classification project.
You can classify any kind of asset: image, text, video, PDF, etc. For the sake of clarity, we will use images in this tutorial. Here are the main steps:
1. [What is classification](#classification)
2. [Connection ... | github_jupyter |
# Lecture 19 – Applying
## Data 94, Spring 2021
```
from datascience import *
import numpy as np
```
## Motivation
```
pups = Table.read_table('data/pups.csv')
pups
pups.with_columns(
'human years', pups.column('age') * 7
)
```
## Apply
```
def seven_times(x):
return 7 * x
pups.apply(seven_times, 'age')
`... | github_jupyter |
<a href="https://colab.research.google.com/github/deathstar1/Machine-Learning-Notebooks/blob/main/Writing_Poetry_With_LSTMs.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
from tensorflow.keras.preprocessing.sequence import pad_sequences
from t... | github_jupyter |
# CCPi CIL and SIRF
* CIL is an heterogeneous collection of software codes for Computed Tomography
* Beam Hardening
* Framework for iterative reconstruction algorithm development in Python
* Denoising toolkit for proximal splitting algorithms (C/CUDA)
* Digital Volume correlation (for strain)
* Visualisation (3D View... | github_jupyter |
```
# python3 -m venv .venv
# source .venv/bin/activate
# pip install mellow_strategy_sdk
from mellow_sdk.primitives import Pool, POOLS
from mellow_sdk.data import RawDataUniV3
from mellow_sdk.strategies import AbstractStrategy
from mellow_sdk.backtest import Backtest
from mellow_sdk.viewers import RebalanceViewer, Uni... | github_jupyter |
```
import sys
import pandas as pd
import numpy as np
import matplotlib
import seaborn
import sklearn
print('{}'.format(sys.version))
print('{}'.format(matplotlib.__version__))
print('{}'.format(pd.__version__))
print('{}'.format(np.__version__))
print('{}'.format(seaborn.__version__))
print('{}'.format(sklearn.__vers... | github_jupyter |
# Defensive Programming
### Learning Objectives
* Explain what an assertion is.
* Add assertions that check the program's state is correct.
* Correctly add precondition and postcondition assertions to functions.
* Explain what test-driven development is, and use it when creating new functions.
* Explain why... | github_jupyter |
```
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '1'
import numpy as np
import tensorflow as tf
import json
with open('dataset-bpe.json') as fopen:
data = json.load(fopen)
train_X = data['train_X']
train_Y = data['train_Y']
test_X = data['test_X']
test_Y = data['test_Y']
EOS = 2
GO = 1
vocab_size = 32000
train_Y ... | 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 |
##### Copyright 2020 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 torch
import torch.nn as nn
import matplotlib.pyplot as plt
import scipy.linalg as sl
import numpy as np
import pandas as pd
import arff
from copy import deepcopy
import tqdm
# additionally requires libcpab (https://github.com/SkafteNicki/libcpab)
import nwarp
# Please download the USP Data Stream repositor... | github_jupyter |
## imports
```
%load_ext autoreload
%autoreload 2
%matplotlib inline
from fastai.imports import *
from fastai.structured import *
import time
from gplearn.genetic import SymbolicTransformer
from pandas_summary import DataFrameSummary
from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier
from IPyt... | github_jupyter |
```
import pandas as pd
import json
import datetime
import time
import os
from corr_plot import corrplot
import numpy as np
from lgbm_consumption_module import data_preprocessing_interventions, lgbm_regression_efecto_acumulado_con_linea_base_del_experimento
import matplotlib
from auxiliary import week_of_month, graph_c... | github_jupyter |
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
# Tutorial: Prepare data for regression modeling
In this tutorial, you learn how to prepare data for regression modeling by using the Azure Machine Learning Data Prep SDK. You run various transformations to filter and combine t... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.