code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
```
from cbrain.imports import *
from cbrain.utils import *
from cbrain.normalization import *
import h5py
from sklearn.preprocessing import OneHotEncoder
class DataGeneratorClassification(tf.keras.utils.Sequence):
def __init__(self, data_fn, input_vars, output_vars, percentile_path, data_name,
nor... | github_jupyter |
```
import warnings
warnings.filterwarnings('ignore')
import pandas as pd
from plotnine import *
%ls
test = pd.read_csv('shoppingmall_info_template.csv', encoding='cp949')
test.shape
test.head()
test.columns
test.head()
test['Category'] = test['Name'].str.extract(r'^(스타필드|롯데몰)\s.*')
test
import folium
geo_df = test
ma... | github_jupyter |
# Developing an AI application
Going forward, AI algorithms will be incorporated into more and more everyday applications. For example, you might want to include an image classifier in a smart phone app. To do this, you'd use a deep learning model trained on hundreds of thousands of images as part of the overall appli... | github_jupyter |
<h3>Implementation Of Doubly Linked List in Python</h3>
<p> It is similar to Single Linked List but the only Difference lies that it where in Single Linked List we had a link to the next data element ,In Doubly Linked List we also have the link to previous data element with addition to next link</p>
<ul> <b>It has thre... | github_jupyter |
```
#import libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(font_scale = 1.2, style = 'darkgrid')
%matplotlib inline
import warnings
warnings.filterwarnings("ignore")
#change display into using full screen
from IPython.core.display import display, HTML
di... | github_jupyter |
# Along isopycnal spice gradients
Here we consider the properties of spice gradients along isopycnals. We do this using the 2 point differences and their distributions.
This is similar (generalization) to the spice gradients that Klymak et al 2015 considered.
```
import numpy as np
import xarray as xr
import glide... | github_jupyter |
<a href="https://colab.research.google.com/github/penningjoy/MachineLearningwithsklearn/blob/main/Part_2__FeatureEngineering.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
### Feature Selection
Feature Selection is a very important part of Feature... | github_jupyter |
# CarND Object Detection Lab
Let's get started!
```
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from PIL import ImageDraw
from PIL import ImageColor
import time
from scipy.stats import norm
%matplotlib inline
plt.style.use('ggplot')
```
## MobileNets
[*MobileNet... | github_jupyter |
```
import pandas as pd
from influxdb import DataFrameClient
user = 'root'
password = 'root'
dbname = 'base47'
host='localhost'
port=32768
# Temporarily avoid line protocol time conversion issues #412, #426, #431.
protocol = 'json'
client = DataFrameClient(host, port, user, password, dbname)
print("Create pandas DataFr... | github_jupyter |
```
import numpy as np
import tensorflow as tf
import collections
def build_dataset(words, n_words):
count = [['GO', 0], ['PAD', 1], ['EOS', 2], ['UNK', 3]]
count.extend(collections.Counter(words).most_common(n_words - 1))
dictionary = dict()
for word, _ in count:
dictionary[word] = len(dictiona... | github_jupyter |
# Word2Vec笔记
学习word2vec的skip-gram实现,除了skip-gram模型还有CBOW模型。
Skip-gram模式是根据中间词,预测前后词,CBOW模型刚好相反,根据前后的词,预测中间词。
那么什么是**中间词**呢?什么样的词才叫做**前后词**呢?
首先,我们需要定义一个窗口大小,在窗口里面的词,我们才有中间词和前后词的定义。一般这个窗口大小在5-10之间。
举个例子,我们设置窗口大小(window size)为2:
```bash
|The|quick|brown|fox|jump|
```
那么,`brown`就是我们的中间词,`The`、`quick`、`fox`、`jump`就是前后词。
... | github_jupyter |
```
import pandas as pd
import json
import numpy as np
df = pd.read_csv('data/eiti-summary-company-payments.csv')
df = df[df['country'] == "Myanmar"]
df.head()
```
## Clean data
```
df["company_name"].unique()
companies_info_df = pd.read_csv('data/eiti_summary_companies_cleaned.csv')
companies_info_df.head()
df = pd.... | github_jupyter |
```
import sys
import cv2 as cv
import os
import numpy as np
from PyQt5.QtWidgets import QApplication, QDialog, QFileDialog
from ui import *
class MainWindow(QDialog, Ui_Form):
def __init__(self, parent=None):
super(MainWindow, self).__init__()
self.setupUi(self)
# Variables for initializa... | github_jupyter |
# Regularization with SciKit-Learn
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv('Data/Advertising.csv')
df.head()
X = df.drop('sales', axis=1)
y = df['sales']
```
### Polynomial Conversion
```
from sklearn.preprocessing import PolynomialFeatures
po... | github_jupyter |
```
from chessnet.notebook_config import *
dfs = {
"OTB": pd.read_csv(ARTIFACTS_DIR / f"{Database.OTB}.csv"),
"Portal": pd.read_csv(ARTIFACTS_DIR / f"{Database.Portal}.csv"),
}
games_per_player_dict = {}
for i, (name, df) in enumerate(dfs.items()):
players = pd.concat([
df[["White"]].dropna().rename... | github_jupyter |
```
# -- coding: utf-8 --
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modi... | github_jupyter |
```
from datascience import *
path_data = '../../data/'
import matplotlib
matplotlib.use('Agg', warn=False)
%matplotlib inline
import matplotlib.pyplot as plots
plots.style.use('fivethirtyeight')
import numpy as np
```
### The Monty Hall Problem ###
This [problem](https://en.wikipedia.org/wiki/Monty_Hall_problem) has... | github_jupyter |
---
# Langages de script - Python
## Cours 9 — Pip et virtualenv
### M2 Ingénierie Multilingue - INaLCO
---
- Loïc Grobol <loic.grobol@gmail.com>
- Yoann Dupont <yoa.dupont@gmail.com>
# Les modules sont vos amis
Rappel des épisodes précédents
## Ils cachent vos implémentations
- Quand on code une interface, on a... | github_jupyter |
<h1>Optimized analysis of WMLs using MRI</h1>
```
%%HTML
<h1>Imports</h1>
#coding=utf-8
#matplotlib.use('Agg')
from numpy import *
import numpy
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from skimage import color
import dicom
from io import StringIO
import sys
import glob, urllib, os
from ... | github_jupyter |
# Ungraded Lab Part 2 - Consuming a Machine Learning Model
Welcome to the second part of this ungraded lab!
**Before going forward check that the server from part 1 is still running.**
In this notebook you will code a minimal client that uses Python's `requests` library to interact with your running server.
```
imp... | github_jupyter |
TSG028 - Restart node manager on all storage pool nodes
=======================================================
Description
-----------
### Parameters
```
container='hadoop'
command=f'supervisorctl restart nodemanager'
```
### Instantiate Kubernetes client
```
# Instantiate the Python Kubernetes client into 'api' ... | github_jupyter |
```
# Notebook for ner results table
import pandas as pd
import numpy as np
import json
raw_path = '/notebook/ue/uncertainty-estimation/workdir/run_calc_ues_metrics/electra-metric/'
#reg_path = '/data/gkuzmin/uncertainty-estimation/workdir/run_calc_ues_metrics/conll2003_electra_reg_01_fix/'
ues = ['last', 'all', 'dpp'... | github_jupyter |
```
import sys
import os
sys.path.append(os.path.abspath("../.."))
from pythonbacktest.datafeed import CSVDataFeed
from pythonbacktest.backtestengine import BasicBackTestEngine
from pythonbacktest.strategy import import_strategy
from pythonbacktest.broker import BackTestBroker
from pythonbacktest.tradelog import Memor... | github_jupyter |
# Full Adder
Below is a Logisim diagram of a Full Adder circuit implementation.

First we begin by importing magma. We will use the prefix `m` to distinguish between magma functions and native Python.
```
import magma as m
```
The following information was taken from the Lattice ... | github_jupyter |
# Developing an AI application
Going forward, AI algorithms will be incorporated into more and more everyday applications. For example, you might want to include an image classifier in a smart phone app. To do this, you'd use a deep learning model trained on hundreds of thousands of images as part of the overall appli... | github_jupyter |
```
import pandas as pd
pd.set_option("display.max_columns", 500)
pd.set_option("display.max_rows", 500)
```
## Table description generation
Enter the following info:
- Table name
- Location
- Separator
- Encoding (optional)
- Decimal mark (optional)
```
table = "MX_COTIZ_ALL.tsv"
location = "../../data/raw"
s... | github_jupyter |
A notebook that contains evaluation timeseries and correlation plots that compare data from the King County mooring at Twanoh in Hood Canal to the model data. The data used are daily averages of the modeled and observed data.
```
import sys
sys.path.append('/ocean/kflanaga/MEOPAR/analysis-keegan/notebooks/Tools')
impo... | github_jupyter |
# ASTE Release 1: Accessing the output with xmitgcm's llcreader module
The Arctic Subpolar gyre sTate Estimate (ASTE) is a medium resolution, dynamically consistent, data constrained
simulation of the ocean and sea ice state in the Arctic and subpolar gyre, spanning 2002-2017.
See details on Release 1 in [Nguyen et al... | github_jupyter |
# Multi-Layer Perceptron, MNIST
---
In this notebook, we will train an MLP to classify images from the [MNIST database](http://yann.lecun.com/exdb/mnist/) hand-written digit database.
The process will be broken down into the following steps:
>1. Load and visualize the data
2. Define a neural network
3. Train the model... | github_jupyter |
# Location and the deviation survey
Most wells are vertical, but many are not. All modern wells have a deviation survey, which is converted into a position log, giving the 3D position of the well in space.
`welly` has a simple way to add a position log in a specific format, and computes a position log from it. You c... | github_jupyter |
```
# Script to calculate the holdings of a hypothetical market-cap weighted crypto-ETF.
TOP_X_CRYPTOS = 5 # Thresholded up to 100
DONT_INCLUDE_TOP_X = 0
TOTAL_AMOUNT_TO_INVEST = 3000 # dollars
BLACK_LISTED_SYMBOLS = {"USDT", "USDC", "UST", "BUSD", "DAI"}
from selenium import webdriver
from webdriver_manager.chrome ... | github_jupyter |
# <span style="color:Maroon">Trade Strategy
__Summary:__ <span style="color:Blue">In this code we shall test the results of given model
```
# Import required libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
np.random.seed(0)
import warnings
warnings.filterwarnings('ignore')
#... | github_jupyter |
```
# To support both python 2 and python 3
from __future__ import division, print_function, unicode_literals
%config InlineBackend.figure_format = 'svg' ###配置可以保存为矢量图
%matplotlib inline
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
import sci... | github_jupyter |
# Transfer Learning Template
```
%load_ext autoreload
%autoreload 2
%matplotlib inline
import os, json, sys, time, random
import numpy as np
import torch
from torch.optim import Adam
from easydict import EasyDict
import matplotlib.pyplot as plt
from steves_models.steves_ptn import Steves_Prototypical_Network
... | github_jupyter |
```
!pip install -Uq catalyst gym
```
# Seminar. RL, DDPG.
Hi! It's a second part of the seminar. Here we are going to introduce another way to train bot how to play games. A new algorithm will help bot to work in enviroments with continuos actinon spaces. However, the algorithm have no small changes in bot-envirome... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import norm
from scipy.stats import stats
import math
import random
from matplotlib import pyplot as plt
import numpy as np
import matplotlib.backends.backend_pdf
import random
import math
import numpy a... | github_jupyter |
```
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import cv2
# Using glob to read all pokemon images at once
# Don't forget to change the path when copying this project
import glob
images = [cv2.imread(file) for file in glob.glob("C:/Users/Rahul/Desktop/data/Pikachu... | github_jupyter |
# **0) Imports**
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import re
import pathlib
import glob
import os
!git clone https://github.com/loier13/IEOR235.git
# set option below so Pandas dataframe can output readable text, not truncated
pd.set_option('display.max_... | github_jupyter |
# Notebook used to visualize the daily distribution of electrical events, as depicted in the data descriptor
## Load packages and basic dataset information
```
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from sklearn.preprocessing import MinMaxScaler
from matplotlib import pa... | github_jupyter |
# Baseline training on network and other features besides text content
```
import numpy as np
import pandas as pd
from sklearn.dummy import DummyClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report
from sklearn.neural_network import MLPClassifier
```
# Data... | github_jupyter |
# Steam equilibrating with liquid water
Accident scenario: steam leaks into a rigid, insulated tank that is partially filled with water.
The steam and liquid water are not initially at thermal equilibrium, though they are at the same pressure. The steam is at temperature $T_{s,1}$ = 600 C and pressure $P_1$ = 20 MPa.... | github_jupyter |
```
import pandas as pd
import matplotlib.pyplot as plt
# for benchmarks
# on 18000 frame episodes, average of 10 episodes
soloRandomScores = {
'Alien-v0': 164.0,'Asteroids-v0': 815.0,'Atlantis-v0': 21100.0,'BankHeist-v0': 17.0,
'BattleZone-v0': 3300.0,'Bowling-v0': 20.2,'Boxing-v0': 2.4,'Centipede-v0': 2229... | github_jupyter |
# TRAIN WHEEL DEFECT DETECTION
```
#The following dataset has the values captured by the sensors placed on railway tracks.
#Sensors detect the force applied on them.
#Variations in the values of force occur due to three different types of defects.
#The dataset has a defect attribute which is the class attribute.
#The ... | github_jupyter |
# Discretization
---
In this notebook, you will deal with continuous state and action spaces by discretizing them. This will enable you to apply reinforcement learning algorithms that are only designed to work with discrete spaces.
### 1. Import the Necessary Packages
```
import sys
import gym
import numpy as np
i... | github_jupyter |
# Statistics
```
num_friends = [100.0,49,41,40,25,21,21,19,19,18,18,16,15,
15,15,15,14,14,13,13,13,13,12,12,11,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,9,9
,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,8,8,8,8,
8,8,8,8,8,8,8,8,7,7,7,7,7,7,7,7,7,7,7,7,7,7
... | github_jupyter |
```
#@title Clone MelGAN-VC Repository
! git clone https://github.com/moiseshorta/MelGAN-VC.git
#@title Mount your Google Drive
#Mount your Google Drive account
from google.colab import drive
drive.mount('/content/drive')
#Get Example Datasets
%cd /content/
#Target Audio = Antonio Zepeda - Templo Mayor
!wget --load-... | github_jupyter |
# VQE for Unitary Coupled Cluster using tket
In this tutorial, we will focus on:<br>
- building parameterised ansätze for variational algorithms;<br>
- compilation tools for UCC-style ansätze.
This example assumes the reader is familiar with the Variational Quantum Eigensolver and its application to electronic struct... | github_jupyter |

# Sequences
In some cases, one may want to intersperse ideal unitary gates within a sequence of time-dependent operations. This is possible using an object called a [Sequence](../api/classes.rst#Sequence). A `Sequence` is essentially a list containing [PulseSequences]... | github_jupyter |
```
import numpy as np
import pandas as pd
import os
# import matplotlib.pyplot as plt
# from PIL import Image, ImageDraw, ImageEnhance
from tqdm.notebook import tqdm
# import cv2
import re
import time
import sys
sys.path.append('../')
from retinanet import coco_eval
from retinanet import csv_eval
from retinanet imp... | github_jupyter |
```
import pandas as pd
import numpy as np
import os
from collections import Counter
from tqdm import tqdm
```
# Data Analysis
```
data = pd.read_csv("test.csv",engine = 'python')
data.tail()
colum = data.columns
for i in colum:
print(f'{len(set(data[i]))} different values in the {i} column')
print(f"\ntotal numb... | github_jupyter |
# recreating the paper with tiny imagenet
First we're going to take a stab at the most basic version of DeViSE: learning a mapping between image feature vectors and their corresponding labels' word vectors for imagenet classes. Doing this with the entirety of imagenet feels like overkill, so we'll start with tiny image... | github_jupyter |
```
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
import matplotlib
matplotlib.rcParams['figure.figsize']=(20,10)
df1 = pd.read_csv('Bengaluru_House_Data.csv')
df1.head()
df1.shape
df1.groupby('area_type')['area_type'].agg('count')
df2 = df1.drop(['area_type','availabi... | github_jupyter |
# Machine Learning and Statistics for Physicists
Material for a [UC Irvine](https://uci.edu/) course offered by the [Department of Physics and Astronomy](https://www.physics.uci.edu/).
Content is maintained on [github](github.com/dkirkby/MachineLearningStatistics) and distributed under a [BSD3 license](https://openso... | github_jupyter |
# CS375 - Assignment 2: Shallow bottleneck and sparse shallow bottleneck
In this notebook I implemented the shallow bottleneck and sparse variants and trained them on CIFAR-10. I also trained a shallow bottleneck on the imagenet dataset with poor overall results but much better categorization compared to the models tr... | github_jupyter |
## Instrucciones generales
1. Forme un grupo de **máximo tres estudiantes**
1. Versione su trabajo usando un **repositorio <font color="red">privado</font> de github**. Agregue a sus compañeros y a su profesor (usuario github: phuijse) en la pestaña *Settings/Manage access*. No se aceptarán consultas si la tarea no e... | github_jupyter |
# ConsPortfolioModel Documentation
[](https://mybinder.org/v2/gh/econ-ark/DemARK/master?filepath=notebooks%2FConsPortfolioModelDoc.ipynb)
```
# Setup stuff
import HARK.ConsumptionSaving.ConsPortfolioModel as cpm
import HARK.ConsumptionSaving.ConsumerParameters as param
i... | github_jupyter |
# Тест. Практика проверки гипотез
По данным опроса, 75% работников ресторанов утверждают, что испытывают на работе существенный стресс, оказывающий негативное влияние на их личную жизнь. Крупная ресторанная сеть опрашивает 100 своих работников, чтобы выяснить, отличается ли уровень стресса работников в их ресторанах о... | github_jupyter |
```
import os
md_dir = os.path.join(os.getcwd(), 'mds')
md_filenames = [os.path.join(os.getcwd(), 'mds', filename) for filename in os.listdir(md_dir)]
print(md_filenames)
from collections import namedtuple
LineStat = namedtuple('LineStat', 'source cleaned line_num total_lines_in_text is_header')
lines = []
for f in... | github_jupyter |
Internet Resources:
[Python Programming.net - machine learning episodes 39-42](https://pythonprogramming.net/hierarchical-clustering-mean-shift-machine-learning-tutorial/)
```
import matplotlib.pyplot as plt
from matplotlib import style
style.use('ggplot')
import numpy as np
from sklearn.datasets import make_blobs
X... | github_jupyter |
# Using the same code as before, please solve the following exercises
2. Play around with the learning rate. Values like 0.00001, 0.0001, 0.001, 0.1, 1 are all interesting to observe.
Useful tip: When you change something, don't forget to RERUN all cells. This can be done easily by clicking:
Kernel -> R... | github_jupyter |
<a id="item31"></a>
# 203 - Build a Regression Model in Keras
## Load Libs
```
import numpy as np
import pandas as pd
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import train_test_split
import keras
from keras.layers import Dense
from keras.models import Sequential
```
## Load datase... | github_jupyter |
```
# Train number of different models from Flair framework.
# With different sized trainin data
# save predictions of each model to file
# Notice - 1st run may take long as model weights are downloaded
# Dataset
# https://github.com/t-davidson/hate-speech-and-offensive-language
# Paper
# https://aaai.org/ocs/index.p... | github_jupyter |
```
'''Example script to generate text from Nietzsche's writings.
At least 20 epochs are required before the generated text
starts sounding coherent.
It is recommended to run this script on GPU, as recurrent
networks are quite computationally intensive.
If you try this script on new data, make sure your corpus
has at l... | github_jupyter |
#Plotting Velocities and Tracers on Vertical Planes
This notebook contains discussion, examples, and best practices for plotting velocity field and tracer results from NEMO on vertical planes.
Topics include:
* Plotting colour meshes of velocity on vertical sections through the domain
* Using `nc_tools.timestamp()` t... | github_jupyter |
**This notebook is an exercise in the [Natural Language Processing](https://www.kaggle.com/learn/natural-language-processing) course. You can reference the tutorial at [this link](https://www.kaggle.com/matleonard/word-vectors).**
---
# Vectorizing Language
Embeddings are both conceptually clever and practically ef... | github_jupyter |
# TV Script Generation
In this project, you'll generate your own [Simpsons](https://en.wikipedia.org/wiki/The_Simpsons) TV scripts using RNNs. You'll be using part of the [Simpsons dataset](https://www.kaggle.com/wcukierski/the-simpsons-by-the-data) of scripts from 27 seasons. The Neural Network you'll build will gen... | github_jupyter |
# ETL Pipeline Preparation
Follow the instructions below to help you create your ETL pipeline.
### 1. Import libraries and load datasets.
- Import Python libraries
- Load `messages.csv` into a dataframe and inspect the first few lines.
- Load `categories.csv` into a dataframe and inspect the first few lines.
```
# imp... | github_jupyter |
```
# Phong_Thesis
```
# <center>Hệ thống tự động nhận diện trạng thái bãi đỗ xe</center>
## Lý thuyết
Hệ thống được hình thành để phân loại các lot đậu xe thành 2 loại là trống hoặc đã có xe đỗ vào. Hệ thống này đặc biệt tối ưu với các bãi đỗ xe có camera ở các cột đèn hay có tầm nhìn thoáng và rộng. Hệ thống sử dụn... | github_jupyter |
# EDA Case Study: House Price
### Task Description
House Prices is a classical Kaggle competition. The task is to predicts final price of each house. For more detail, refer to https://www.kaggle.com/c/house-prices-advanced-regression-techniques/.
### Goal of this notebook
As it is a famous competition, there exists l... | github_jupyter |
# Keyword Spotting Dataset Curation
[](https://colab.research.google.com/github/ShawnHymel/ei-keyword-spotting/blob/master/ei-audio-dataset-curation.ipynb)
Use this tool to download the Google Speech Commands Dataset, combine it with your own... | github_jupyter |
<a href="https://colab.research.google.com/github/felipe-parodi/QuantTools4Neuro/blob/master/PCA_PyDSHandbook.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
<!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="https://github.c... | github_jupyter |
# StateFarm Distracted Driver Detection Full Dataset
```
%cd /home/ubuntu/kaggle/state-farm-distracted-driver-detection
# Make sure you are in the main directory (state-farm-distracted-driver-detection)
%pwd
# Create references to key directories
import os, sys
from glob import glob
from matplotlib import pyplot as pl... | github_jupyter |
<img src="../img/logo_white_bkg_small.png" align="right" />
# Worksheet 3: Detecting Domain Generation Algorithm (DGA) Domains against DNS
This worksheet covers concepts covered in the second half of Module 6 - Hunting with Data Science. It should take no more than 20-30 minutes to complete. Please raise your hand... | github_jupyter |
```
import pandas as pds
import numpy as np
import matplotlib.pyplot as plt
method_dict = {"vi": "D-CODE", "diff": "SR-T", "spline": "SR-S", "gp": "SR-G"}
val_dict = {
"noise": "sigma",
"freq": "del_t",
"n": "n",
}
ode_list = ["GompertzODE", "LogisticODE"]
def plot_df(df, x_val="sigma"):
for method in m... | github_jupyter |
# Standard Network Models
## 1. Multilayer Perceptron(MLP)
* Model for binary classification
* The model has 10 inputs,3 hidden layers with 10,20 and 10 neurons and an output layer with 1 output.
* Rectified linear activation functions are used in each hidden layer and s sigmoid activation function is used in the outp... | github_jupyter |
## Importing libraries
```
import pandas as pd
import numpy as np
import pickle
import matplotlib.pyplot as plt
from scipy import stats
import tensorflow as tf
import seaborn as sns
from pylab import rcParams
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from sklea... | github_jupyter |
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
# Tutorial: Train a classification model with automated machine learning
In this tutorial, you'll learn how to generate a machine learning model using automated machine learning (automated ML). Azure Machine Learning can perf... | github_jupyter |
```
import glob, os
import pandas as pd
import shutil
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
from matplotlib import colors as mcolors
import numpy as np
import math
from sklearn.preprocessing import MinMaxScaler, StandardScaler
from sklearn.neural_network import MLPClassifie... | github_jupyter |
Sveučilište u Zagrebu
Fakultet elektrotehnike i računarstva
## Strojno učenje 2018/2019
http://www.fer.unizg.hr/predmet/su
------------------------------
### Laboratorijska vježba 5: Probabilistički grafički modeli, naivni Bayes, grupiranje i vrednovanje klasifikatora
*Verzija: 1.4
Zadnji put ažurirano: 1... | github_jupyter |
```
import math
import numpy as np
import h5py
import matplotlib.pyplot as plt
import pandas as pd
import tensorflow as tf
from tensorflow.python.framework import ops
%matplotlib inline
# Load training data set
train = pd.read_json('../input/train.json')
train.head()
def convert_to_one_hot(arr, c):
one_hot_arr = n... | github_jupyter |
# Natural Language Processing
## Importing the libraries
```
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
```
## Importing the dataset
```
dataset = pd.read_csv('Restaurant_Reviews.tsv', delimiter = '\t', quoting = 3)
```
## Cleaning the texts
```
import re
import nltk
nltk.download('sto... | github_jupyter |
---
# A simple regression example using parametric and non-parametric methods
---
This is a simple example where we use two regression methods to enhance the overall data distribution from a dataset.
1. A Linear fit (<i>parametric</i> method).
2. The LOWESS method method (<i>non-parametric</i> method) that is often... | github_jupyter |
# Ungraded Lab: Mask R-CNN Image Segmentation Demo
In this lab, you will see how to use a [Mask R-CNN](https://arxiv.org/abs/1703.06870) model from Tensorflow Hub for object detection and instance segmentation. This means that aside from the bounding boxes, the model is also able to predict segmentation masks for each... | github_jupyter |
```
import pandas as pd
df_budget = pd.read_csv('Resources/budget_data.csv')
dates = df_budget.Date.to_list()
profits = df_budget['Profit/Losses'].to_list()
number_months = len(dates)
total_amount = sum(profits)
change_weight = 1/(number_months - 1)
average_change = sum((profits[i] - profits[i-1]) * change_weight for i... | github_jupyter |
<a href="https://colab.research.google.com/github/AI4Finance-Foundation/FinRL/blob/master/FinRL_Ensemble_StockTrading_ICAIF_2020.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Deep Reinforcement Learning for Stock Trading from Scratch: Multiple S... | github_jupyter |
# GRU 212
* Operate on 16000 GenCode 34 seqs.
* 5-way cross validation. Save best model per CV.
* Report mean accuracy from final re-validation with best 5.
* Use Adam with a learn rate decay schdule.
```
NC_FILENAME='ncRNA.gc34.processed.fasta'
PC_FILENAME='pcRNA.gc34.processed.fasta'
DATAPATH=""
try:
from google... | github_jupyter |
# Lambda School Data Science Module 141
## Statistics, Probability, and Inference
## Prepare - examine what's available in SciPy
As we delve into statistics, we'll be using more libraries - in particular the [stats package from SciPy](https://docs.scipy.org/doc/scipy/reference/tutorial/stats.html).
```
from scipy im... | github_jupyter |
# Chaper 8 - Intrinsic Curiosity Module
#### Deep Reinforcement Learning *in Action*
##### Listing 8.1
```
import gym
from nes_py.wrappers import BinarySpaceToDiscreteSpaceEnv #A
import gym_super_mario_bros
from gym_super_mario_bros.actions import SIMPLE_MOVEMENT, COMPLEX_MOVEMENT #B
env = gym_super_mario_bros.make('... | github_jupyter |
```
import pandas as pd
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D, MaxPool2D, Dense, Flatten, Dropout
from tensorflow.keras.utils import to_categorical
import os
import datetime
%load_ext tensorboard
import matplotlib.pyplot ... | github_jupyter |
# Fuzzing with Grammars
In the chapter on ["Mutation-Based Fuzzing"](MutationFuzzer.ipynb), we have seen how to use extra hints – such as sample input files – to speed up test generation. In this chapter, we take this idea one step further, by providing a _specification_ of the legal inputs to a program. Specifying ... | github_jupyter |
```
import requests
import json
import re
# Setting the base URL for the ARAX reasoner and its endpoint
endpoint_url = 'https://arax.rtx.ai/api/rtx/v1/query'
# Given we have some chemical substances which are linked to asthma exacerbations for a certain cohort of patients,
# we want to find what diseases are associate... | github_jupyter |
# Python: the basics
Python is a general purpose programming language that supports rapid development
of scripts and applications.
Python's main advantages:
* Open Source software, supported by Python Software Foundation
* Available on all major platforms (ie. Windows, Linux and MacOS)
* It is a general-purpose pro... | github_jupyter |
# Tensor Manipulation: Psi4 and NumPy manipulation routines
Contracting tensors together forms the core of the Psi4NumPy project. First let us consider the popluar [Einstein Summation Notation](https://en.wikipedia.org/wiki/Einstein_notation) which allows for very succinct descriptions of a given tensor contraction.
F... | github_jupyter |
# Joint Probability
This notebook is part of [Bite Size Bayes](https://allendowney.github.io/BiteSizeBayes/), an introduction to probability and Bayesian statistics using Python.
Copyright 2020 Allen B. Downey
License: [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons... | github_jupyter |
# KNN
Here we use K Nearest Neighbors algorithm to perform classification and regression
```
import numpy as np
import matplotlib.pyplot as plt
import sys
import pandas as pd
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import train_test_split
from rdkit import Chem, DataStructs
from sk... | github_jupyter |
# Dispersion relations in a micropolar medium
We are interested in computing the dispersion relations in a
homogeneous micropolar solid.
## Wave propagation in micropolar solids
The equations of motion for a micropolar solid are given by [[1, 2]](#References)
\begin{align}
&c_1^2
\nabla\nabla\cdot\mathbf{u}- c_2^2\... | github_jupyter |
#### A multiclass classification problem
by Aries P. Valeriano and Dave Emmanuel Q. Magno
## Executive Summary
The goal of this project is to a build a prediction model that make use of stock chart pattern, in particular double top to predict the next movement of stock price if it will decrease further, increase, o... | 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 |
```
%matplotlib inline
from __future__ import print_function
from __future__ import division
import os
import pandas as pd
import numpy as np
from tqdm import tqdm_notebook
from matplotlib import pyplot as plt
from matplotlib.colors import rgb2hex
import seaborn as sns
import statsmodels.api as sm
# let's not pol... | github_jupyter |
# UNSEEN-open
In this project, the aim is to build an open, reproducible, and transferable workflow for UNSEEN.
<!-- -- an increasingly popular method that exploits seasonal prediction systems to assess and anticipate climate extremes beyond the observed record. The approach uses pooled forecasts as plausible alternat... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.