text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
```
import numpy as np
import pandas as pd
import pyodbc
import time
import pickle
import operator
from operator import itemgetter
from joblib import Parallel, delayed
from sklearn import linear_model
from sklearn.linear_model import Ridge
from sklearn.tree import DecisionTreeRegressor
from sklearn.model_selection im... | github_jupyter |
```
# Import some libraries
import torch
import torchvision
from torch import nn
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.datasets import MNIST
from matplotlib import pyplot as plt
# Convert vector to image
def to_img(x):
x = 0.5 * (x + 1)
x = x.view(x.size(0... | github_jupyter |
```
import numpy as np
import pandas as pd
#import matplotlib.pylab as plt
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import silhouette_score
from sklearn import cluster
from sklearn.cluster import KMeans
from sklearn.datasets import make_blobs
import seaborn as ... | github_jupyter |
```
import numpy as np
import pandas as pd
import treelib
from pathlib import Path
from treelib import Node, Tree
DATA_DIR = Path('../../data/retail-rocket')
EXPORT_DIR = Path('../../data/retail-rocket') / 'saved'
PATH_CATEGORY_TREE = DATA_DIR / 'category_tree.csv'
PATH_EVENTS = DATA_DIR /'events.csv'
PATH_ITEM_PROPS... | github_jupyter |
# VQGAN+CLIP Simplificado
```
# Licensed under the MIT License
# Copyright (c) 2021 Katherine Crowson
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without... | github_jupyter |
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_10_3_text_generation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# T81-558: Applications of Deep Neural Networks
**Module 10: Time Serie... | github_jupyter |
```
import numpy as np
import pandas as pd
import pickle
import json
import gensim
import os
import re
from sklearn.model_selection import train_test_split
from pandas.plotting import scatter_matrix
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.prepr... | github_jupyter |
# Statistical Data Modeling
Some or most of you have probably taken some undergraduate- or graduate-level statistics courses. Unfortunately, the curricula for most introductory statisics courses are mostly focused on conducting **statistical hypothesis tests** as the primary means for interest: t-tests, chi-squared te... | github_jupyter |
# Tutorial
## Regime-Switching Model
`regime_switch_model` is a set of algorithms for learning and inference on regime-switching model. Let $y_t$ be a $p\times 1$ observed time series and $h_t$ be a homogenous and stationary hidden Markov
chain taking values in $\{1, 2, \dots, m\}$ with transition probabilities
\... | 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 |
```
#load watermark
%load_ext watermark
%watermark -a 'Gopala KR' -u -d -v -p watermark,numpy,pandas,matplotlib,nltk,sklearn,tensorflow,theano,mxnet,chainer,seaborn,keras,tflearn,bokeh,gensim
```
# Cheatsheet for Decision Tree Classification
### Algorithm
1. Start at the root node as parent node
2. Split the parent ... | github_jupyter |
```
from orphics import sehgal, maps
import healpy as hp
from pixell import utils, enmap, curvedsky, enplot, wcsutils
import os
import numpy as np
import matplotlib.pyplot as plt
import lmdb
from cosmikyu import datasets, transforms, config
from pitas import modecoupling
import random
%matplotlib inline
%load_ext aut... | github_jupyter |
```
#import necessary libraries
import torch
from transformers import *
import pandas as pd
import re
import collections
import numpy as np
import json
import time
from tqdm.notebook import tqdm
import torch.nn as nn
import pathlib
#output all items, not just last one
from IPython.core.interactiveshell import Interact... | github_jupyter |
```
# Importing all necessary packages
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
retail = pd.read_csv('../Data/online_retail.csv')
retail
```
# Data Cleaning
```
retail.info()
```
### Figuring out number of missing values in each column
```
retail.isnull().sum().s... | github_jupyter |
# Interpreting Nodes and Edges by Saliency Maps in GAT
This demo shows how to use integrated gradients in graph attention networks to obtain accurate importance estimations for both the nodes and edges. The notebook consists of three parts:
setting up the node classification problem for Cora citation network
training... | github_jupyter |
```
from sketching import settings
from sketching.datasets import Dataset, Covertype_Sklearn, KDDCup_Sklearn, Webspam_libsvm, Synthetic_Dataset, NoisyDataset
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
if not settings.PLOTS_DIR.exists():
settings.PLOTS_DIR.mkdir()
def... | github_jupyter |
Introduction:
In the realm of sports betting, it is very difficult to make consistent profit. Sportsbooks intentionally create odds so that the general public is as close to a 50/50 split on a given game. Therefore, the sportsbooks try to predict the final outcome as accurately as possible. Each bet typically incurs a... | github_jupyter |
# Simple power spectrum estimation from an input dataset
This example shows how to estimate the power spectrum from a set of data files using an Optimal Quadratic Estimator (OQE) approach.
```
%matplotlib inline
from pyuvdata import UVData
import hera_pspec as hp
import numpy as np
import matplotlib.pyplot as plt
impo... | github_jupyter |
### Test to evaluate the use of global mass fraction in tracer solution
The discretized mass conservation equation of a component X can be written as
\begin{equation*}
\frac{m_T\phi-m_T^o\phi^o}{\Delta t}=\sum_{faces} \dot{m}_{face}\phi^{up}_{face}+\dot{m}_{comp}\phi_{comp}
\end{equation*}
where
\begin{equation*}
m_... | github_jupyter |
# parm@frosst-y to SMIRNOFF
This notebook provides examples/utility functionality to assist with conversion of parm@frosst or relatives to SMIRNOFF format. Particularly, Christopher Bayly is generating modified AMBER `frcmod` files where the first entry for each parameter (i.e. `CT-CT-CT`) is replaced by the relevant ... | github_jupyter |
<a href="https://colab.research.google.com/github/WeizmannML/course2020/blob/master/Tutorial6/Graph_Classification_DGL.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
# !pip install dgl
# !pip install networkx
import torch as th
from torch impor... | github_jupyter |
```
# author: Leonardo Filipe
# website: https://www.leonardofilipe.com
# contact: contact[at]leonardofilipe.com
import io
import re
import requests
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('seaborn')
def getdata(tickers,start,end,frequency):
OHLC = {}
cookie = ''
... | github_jupyter |
# Matplotlib
## [`matplotlib`](https://matplotlib.org/) is the most widely used scientific plotting library in Python.
* Commonly use a sub-library called [`matplotlib.pyplot`](https://matplotlib.org/api/pyplot_api.html).
* The Jupyter Notebook will render plots inline if we ask it to using a "magic" command.
```
%m... | github_jupyter |
Tornado 异步非阻塞浅析
===
## 先上代码演示
```
#!/usr/bin/python
# coding: utf-8
"""
File: demo.py
Author: zhangxu01 <zhangxu01@zhihu.com>
Date: 2017-08-28 22:59
Description: demo
"""
import random
import time
import urllib
import requests
import tornado
from tornado import gen, web
from tornado.httpclient import AsyncHTTPClien... | github_jupyter |
```
import matplotlib.pyplot as plt
%matplotlib inline
import IPython.display
import librosa.display
import numpy as np
import librosa
import tensorflow as tf
import glob
c_drone_path = '../../../1m/*.wav'
m_drone_path = '../../../20m/*.wav'
f_drone_path = '../../../50m/*.wav'
background_path = '../../../40sec.wav'
dr... | github_jupyter |
## 1. The most Nobel of Prizes
<p><img style="float: right;margin:5px 20px 5px 1px; max-width:250px" src="https://assets.datacamp.com/production/project_441/img/Nobel_Prize.png"></p>
<p>The Nobel Prize is perhaps the world's most well known scientific award. Except for the honor, prestige and substantial prize money th... | github_jupyter |
# Distribution of Weights in a Network
Varun Nayyar, 2020-08-23
Let us consider the simplest possible neural network, 1 input $x$, 1 output $y$ with some non-linearity $f$. This is expressed as
$$
\begin{aligned}
y = f(wx + b)
\end{aligned}
$$
where $w$, $b$ are the weight and bias in the network. Putting this into... | github_jupyter |
# Self-Driving Car Engineer Nanodegree
## Project: **Finding Lane Lines on the Road**
***
In this project, you will use the tools you learned about in the lesson to identify lane lines on the road. You can develop your pipeline on a series of individual images, and later apply the result to a video stream (really j... | github_jupyter |
<a href="https://colab.research.google.com/github/dheerajrathee/IADS-Summer-School-2021/blob/main/GradientBoostingClassifier_IADS_2021.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
from google.colab import drive
drive.mount('/gdrive')
%cd /gdr... | github_jupyter |
# Facial Expression Recognition Project
## Library Installations and Imports
```
!pip install -U -q PyDrive
!apt-get -qq install -y graphviz && pip install -q pydot
!pip install -q keras
from google.colab import files
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab impor... | github_jupyter |
```
%pylab inline
%pdb
import pandas as pd
from datetime import datetime as dt
import os
import glob
import statsmodels.api as sm
fname = "./data/date-hour-soo-dest-2015.csv"
bart_df = pd.read_csv(fname, names = ["Date", "Hour", "Origin", "Destination", "Count"],
parse_dates = ["Date"], index_col =... | github_jupyter |
### Import libraries and read data
```
from __future__ import division
import pandas as pd
import numpy as np
from numpy import argmax
from scipy import constants
import random
import os
import sys
import re
import pdb
import glob
#import suftware
from sklearn.preprocessing import LabelEncoder
from sklearn.preproce... | github_jupyter |
# Keras Benchmark
##### Importing libraries
```
import numpy as np
import matplotlib.pyplot as plt
from glob import glob
from PIL import Image
from time import time
from sklearn.model_selection import train_test_split
from keras.layers import Conv2D, MaxPooling2D, ZeroPadding2D,\
Dropout, Flatten, Dense
from kera... | github_jupyter |
<!-- dom:TITLE: Demo - Some fast transforms -->
# Demo - Some fast transforms
<!-- dom:AUTHOR: Mikael Mortensen Email:mikaem@math.uio.no at Department of Mathematics, University of Oslo. -->
<!-- Author: -->
**Mikael Mortensen** (email: `mikaem@math.uio.no`), Department of Mathematics, University of Oslo.
Date: **Ma... | github_jupyter |
```
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
class Model(nn.Module):
def __init__(self):
super(Model,self).__init__()
self.conv0 = nn.Conv2d(1, 16, kernel_size=3, padding=5)
self.conv1 = nn.Conv2d(16, 32, kernel_size=3)
def ... | github_jupyter |
<img src="module-01/ScDo-Bandeau_Lingua_Technologies.png" style="width: 100%;float:center;"/>
<h1 style="font-size:200%;text-align:center">Survol des applications de la science des données</h1>
<h1 style="font-size:200%;text-align:center">et de l’intelligence artificielle</h1>
<h2 style="text-align:center">par</h2>
<... | github_jupyter |
# Deep Q-Network (DQN)
---
In this notebook, you will implement a DQN agent with OpenAI Gym's LunarLander-v2 environment.
### 1. Import the Necessary Packages
```
import gym
import random
import torch
import numpy as np
from collections import deque
import matplotlib.pyplot as plt
%matplotlib inline
```
### 2. Insta... | github_jupyter |
### Note
* Instructions have been included for each segment. You do not have to follow them exactly, but they are included to help you think through the steps.
```
# Dependencies and Setup
import pandas as pd
# File to Load (Remember to Change These)
file_to_load = "Resources/purchase_data.csv"
# Read Purchasing Fil... | github_jupyter |
# Part 1 - Point source plotting
To perform a neutronics simulation a neutron source must also be defined.
This python notebook allows users to make a simple OpenMC point source and plot its energy, position and initial directions.
```
from IPython.display import HTML
HTML('<iframe width="560" height="315" src="http... | github_jupyter |
# Calibrating qubits using Qiskit and OpenPulse
Qiskit is an open-source framework for programming quantum computers (Ref. [1](#refs)). Using Qiskit, quantum circuits can be built, simulated and executed on quantum devices.
OpenPulse provides a language for specifying pulse level control (i.e. control of the continuo... | github_jupyter |
## Note-level dataset generation
This notebook uses raw data from the MusicNet dataset to set up sequential numpy arrays suitable for training deep neural networks.
**Before running:** Make sure to run the "Levels Computation" notebook to produce the numpy array files with global audio levels.
```
#### START HERE ##... | github_jupyter |
```
class FooClass:...
def test_sep():...
# local variable
var = "lowercase"
# internal use
_var = "_single_leading_underscore"
# avoid conflicts with Python keyword
var_ = "single_trailing_underscore_"
# a class attribute (private use in class)
__var = " __double_leading_underscore"
# "magic" objects or attri... | github_jupyter |
# Introduction to Python
## Introduction
### Why teach Python?
* In this first session, we will introduce [Python](http://www.python.org).
* This course is about programming for data analysis and visualisation in research.
* It's not mainly about Python.
* But we have to use some language.
### Why Python?
* Pyth... | github_jupyter |
```
## 9/12/17: this notebook subsets the relevant stuff from tf_sketchy.ipynb
## in order to compare triplet features to imagenet-only vgg
## on the image retrieval task
from __future__ import division
import numpy as np
from numpy import *
from sklearn.model_selection import train_test_split
from sklearn.model_sel... | github_jupyter |
# Training Image Classifier
We will use part of the training data provided to us, separated by high level [entity] clusters, to train the image classifier. Due to the scale of the full dataset, a random subsample is taken. See [this notebook block](http://localhost:8888/notebooks/02.train_tiered_classifiers.ipynb#Tr... | github_jupyter |
<h1><center><u>SAC -- 2D Navigation Robot(particle) Environment</u></center></h1>
```
import numpy as np
import matplotlib.pyplot as plt
# %matplotlib notebook
# %matplotlib nbagg
%matplotlib qt
from robolearn.envs.simple_envs.goal_composition import GoalCompositionEnv
from robolearn.envs.normalized_box_env import N... | github_jupyter |
## Sensitivity analysis demonstration
This notebook contains an example of how to account for uncertainty in the parameters of the production process. The resulting variability is explored through a Monte Carlo-based sensitivity analysis, in which different values are used to run the facility and the outputs of intere... | github_jupyter |
<a href="https://colab.research.google.com/github/Tessellate-Imaging/monk_v1/blob/master/study_roadmaps/2_transfer_learning_roadmap/4_effect_of_training_epochs/2)%20Understand%20the%20effect%20of%20number%20of%20epochs%20in%20transfer%20learning%20-%20pytorch.ipynb" target="_parent"><img src="https://colab.research.goo... | github_jupyter |
#Bayesian Inference to predict water well functionality.
In this notebook, we train a model using Bayesian inference and then make predictions based on this model.
```
import pandas as pd
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
import matplotlib.pyplot as plt
%matplotlib inline
```
Belo... | github_jupyter |
# Regular expressions and word tokenization
> This chapter will introduce some basic NLP concepts, such as word tokenization and regular expressions to help parse text. You'll also learn how to handle non-English text and more difficult tokenization you might find. This is the Summary of lecture "Introduction to Natura... | github_jupyter |
# How to build a linear factor model
Algorithmic trading strategies use linear factor models to quantify the relationship between the return of an asset and the sources of risk that represent the main drivers of these returns. Each factor risk carries a premium, and the total asset return can be expected to correspond... | github_jupyter |
# Download the data
## Summary: Create lists with updated stocks yahoo finance codes to download the data
```
# Import required libraries
import os
import pickle
# Get current working directory
mycwd = os.getcwd()
print(mycwd)
# Change to data directory
os.chdir("..")
os.chdir(str(os.getcwd()) + "\\Models")
```... | github_jupyter |
```
# default_exp series.preproc
```
# series.preproc
> Tools for preprocessing DICOM metadata imported using `dicomtools.core` into in a `pandas.DataFrame` in preparation for training RandomForest classifier to predict series type.
```
#hide
from nbdev.showdoc import *
#export
from dicomtools.imports import *
from ... | github_jupyter |
```
import pandas as pd
import numpy as np
import scanpy as sc
import os
from sklearn.cluster import KMeans
from sklearn.cluster import AgglomerativeClustering
from sklearn.metrics.cluster import adjusted_rand_score
from sklearn.metrics.cluster import adjusted_mutual_info_score
from sklearn.metrics.cluster import homog... | github_jupyter |
# week08: Self-critical Sequence Training
_Reference: based on Practical RL_ [week07](https://github.com/yandexdataschool/Practical_RL/blob/master/week07_seq2seq)
This time we'll solve a problem of transribing hebrew words in english, also known as g2p (grapheme2phoneme)
* word (sequence of letters in source languag... | github_jupyter |
# Relativistic kinematics
<h3>Learning goals</h3>
<ul>
<li>Relativistic kinematics.
<li>Standard model particles.
</ul>
<b>Background</b>
If you know the mass of a particle, most of the time you know <i>what that particle is</i>. However, there is no way to just build a single detector that gives you the mas... | github_jupyter |
# QuickSort
Like MergeSort, QuickSort is a divide-and-conquer algorithm. We need to pick a pivot, then sort both sublists that are created on either side of the pivot. Similar to the video, we'll follow the convention of picking the last element as the pivot.
Start with our unordered list of items:

* Create NumPy arrays
* Convert lists and tuples to numpy arrays
* Create (initialise) arrays
* Inspect the structure and content of arrays
* Subset, slice,... | github_jupyter |
# Starbucks Capstone Challenge: Customer Segmentation
### Introduction
This data set contains simulated data that mimics customer behavior on the Starbucks rewards mobile app. Once every few days, Starbucks sends out an offer to users of the mobile app. An offer can be merely an advertisement for a drink or an actual... | github_jupyter |
# Rayleigh Scattering
**Scott Prahl**
**April 2021**
*If miepython is not installed, uncomment the following cell (i.e., delete the #) and run (shift-enter)*
```
#!pip install --user miepython
import numpy as np
import matplotlib.pyplot as plt
try:
import miepython
except ModuleNotFoundError:
print('m... | github_jupyter |
```
# setup
from mlwpy import *
%matplotlib inline
iris = datasets.load_iris()
tts = skms.train_test_split(iris.data, iris.target,
test_size=.33, random_state=21)
(iris_train_ftrs, iris_test_ftrs,
iris_train_tgt, iris_test_tgt) = tts
# normal usage: build-fit-predict-evaluate
baselin... | github_jupyter |
```
from azureml.core import Workspace, Dataset, Datastore
from azureml.core import Environment, Model
from azureml.core.compute import ComputeTarget
from azureml.core.runconfig import RunConfiguration, CondaDependencies, DEFAULT_CPU_IMAGE
from azureml.pipeline.steps import PythonScriptStep
from azureml.pipeline.core i... | github_jupyter |
### Plotting Sine and Cosine Wave in Python
```
import numpy as np
import matplotlib.pyplot as plt
plt.plot()
%matplotlib inline
```
### Sine Wave
```
Time = np.arange(0,200,0.1)
Amplitude = np.sin(Time)
plt.plot(Time, Amplitude)
plt.title('Sine Wave')
plt.xlabel('Time')
plt.ylabel('Amplitude=sin(Time)')
plt.grid(Tr... | github_jupyter |
SOP006 - az logout
==================
Use the az command line interface to logout of Azure.
Steps
-----
### Common functions
Define helper functions used in this notebook.
```
# Define `run` function for transient fault handling, suggestions on error, and scrolling updates on Windows
import sys
import os
import r... | github_jupyter |
# Matplotlib
```
# Notebook Magic Line
%matplotlib inline # create visualizations in the notebook itself
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from google.colab import drive
drive.mount('/content/drive')
df = pd.read_csv("/content/drive/My Drive/Colab Notebooks/PA Projects/ML Class/We... | github_jupyter |
# Transfer Learning on TPUs
In the <a href="3_tf_hub_transfer_learning.ipynb">previous notebook</a>, we learned how to do transfer learning with [TensorFlow Hub](https://www.tensorflow.org/hub). In this notebook, we're going to kick up our training speed with [TPUs](https://www.tensorflow.org/guide/tpu).
## Learning ... | github_jupyter |
```
import pandas as pd
import numpy as np
from tqdm import tqdm
from sklearn.neighbors import BallTree
import seaborn as sns
import geopandas as gpd
from shapely.geometry import Point, LineString
from pyproj import Proj, transform
from matplotlib import pyplot as plt
%matplotlib inline
from urbansim_templates import m... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
from IPython.display import Image
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
import os
import json
import jax.numpy as np
import numpy as onp
import jax
import pickle
import matplotlib.pyplot as plt
import... | github_jupyter |
<a href="https://colab.research.google.com/github/john-s-butler-dit/Intro-to-Algorithms/blob/master/Chapter%201-%20Introduction_to_Algorithms/Analysis%20of%20an%20Algorithm.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Analysis of an Algorithm
#... | github_jupyter |
## Importing and prepping data
```
import pandas as pd
import numpy as np
import diff_classifier.aws as aws
import diff_classifier.pca as pca
features = []
remote_folder = 'Gel_Studies/11_09_18_gel_experiment' #Folder in AWS S3 containing files to be analyzed
bucket = 'ccurtis.data'
vids = 20
gels = ['0_4', '0_6', '0_... | github_jupyter |
# Streaming Algorithms in Machine Learning
In this notebook, we will use an extremely simple "machine learning" task to learn about streaming algorithms. We will try to find the median of some numbers in batch mode, random order streams, and arbitrary order streams.
The idea is to observe first hand the advantages of ... | github_jupyter |
```
import numpy as np
import pandas as pd
import pickle
import time
import itertools
import matplotlib
matplotlib.rcParams.update({'font.size': 17.5})
import matplotlib.pyplot as plt
%matplotlib inline
matplotlib.rc('axes.formatter', useoffset=False)
import sys
import os.path
sys.path.append( os.path.abspath(os.p... | github_jupyter |
# Validating performance of regression models
This notebook explains how to use CNTK metric functions to validate the performance of a regression model.
We're using the [car MPG dataset](https://archive.ics.uci.edu/ml/datasets/Auto+MPG) from the UCI dataset library. This dataset is perfect for demonstrating how to buil... | github_jupyter |
<table align="left" width="100%"> <tr>
<td style="background-color:#ffffff;"><a href="https://qsoftware.lu.lv/index.php/qworld/" target="_blank"><img src="..\images\qworld.jpg" width="35%" align="left"></a></td>
<td align="right" style="background-color:#ffffff;vertical-align:bottom;horizontal-align:... | github_jupyter |
```
import torch
from torch.autograd import Variable
import torch.nn.functional as F
import matplotlib.pyplot as plt
%matplotlib inline
torch.manual_seed(1) # reproducible
# make some fake data and display them
n_data = torch.ones(100, 2)
x0 = torch.normal(2*n_data, 1) # class0 x data (tensor), shape=(100, 2), ... | github_jupyter |
```
##################################################################
#《Python机器学习及实践:从零开始通往Kaggle竞赛之路(2023年度版)》开源代码
#-----------------------------------------------------------------
# @章节号:6.6.2(注意力机制的TensorFlow实践)
# @作者:范淼 ... | github_jupyter |
<img src="images/strathsdr_banner.png" align="left">
# RFSoC QPSK Transceiver
----
<div class="alert alert-box alert-info">
Please use Jupyter Labs http://board_ip_address/lab for this notebook.
</div>
This design is a full QPSK transceiver, which transmits and receives randomly-generated pulse-shaped symbols with ... | github_jupyter |
The notebook measures how well learned reward functions generalize to new environments.
It trains a reward function on a series of environments with different colors for the agent and background. It measures how well the reward function can generalize to colors it hasn't seen before.
```
import gym
import numpy as np
... | github_jupyter |
```
"""
@author: Ajay
"""
import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.data import Dataset, DataLoader
import torch.optim as optim
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from ... | github_jupyter |
```
%matplotlib inline
```
# Wasserstein Discriminant Analysis
This example illustrate the use of WDA as proposed in [11].
[11] Flamary, R., Cuturi, M., Courty, N., & Rakotomamonjy, A. (2016).
Wasserstein Discriminant Analysis.
```
# Author: Remi Flamary <remi.flamary@unice.fr>
#
# License: MIT License
import n... | github_jupyter |
```
import json
import matplotlib.patches as mpatches
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
```
# Load Dataset
```
# image_val_path = 'bdd100k/images/100k/train/'
# label_path = 'bdd100k/labels/bdd100k_labels_images_train.json'
# save_label_path = 'bdd... | github_jupyter |
# Lesson 3 Demo 2: Focus on Primary Key
Cassandra logo
### In this demo we are going to walk through the basics of creating a table with a good Primary Key in Apache Cassandra, inserting rows of data, and doing a simple SQL query to validate the information.
#### We will use a python wrapper/ python driver called ca... | github_jupyter |
In this notebook, we preprocessed the data and feed the data to gradient boosting tree models, and got 1.39 on public leaderboard.
the workflow is as follows:
1. **Data preprocessing**. The purpose of data preprocessing is to achieve higher time/space efficiency. What we did includes round, constant features removal, ... | github_jupyter |
# Task: Decision Tree Classifier
# Author: Vibhuti Mayekar
```
import pandas as pd
import numpy as np
import os
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
from sklearn.model_selection import train_test_split
from sklearn.cluster import KMeans
from sklearn.tree import DecisionTreeClassif... | github_jupyter |
# Artificial Intelligence Nanodegree
## Convolutional Neural Networks
## Project: Write an Algorithm for a Dog Identification App
---
In this notebook, some template code has already been provided for you, and you will need to implement additional functionality to successfully complete this project. You will not n... | github_jupyter |
Copyright 2016 Google Inc. All Rights Reserved.
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 applicable law or agreed to in wri... | github_jupyter |
(Source: http://www.scipy-lectures.org/packages/scikit-learn/index.html#basic-principles-of-machine-learning-with-scikit-learn)
```
%matplotlib notebook
```
## Estimators
Every algorithm is exposed in scikit-learn via an ‘’Estimator’’ object. For instance a linear regression is: `sklearn.linear_model.LinearRegressio... | github_jupyter |
# Building and training a mutli-layer network with Keras
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.optimizers import SGD
%matplotlib inline
```
## Classifying Iris versicolor
Let us know try a s... | github_jupyter |
# Chicago crime dataset analysis
---
This notebook is a Spark and Python learner's to perform data analysis on some real-world data set.
In this notebook, I am capriciously using Spark, Pandas, Matplotlib, Seaborn without any meaningful distinction of purpose. The point is:
* Perform data reading, transforming, and... | github_jupyter |
```
##Author: Gene Burinskiy
!pip install plinkio
#!pip install h5py --for some reason, h5py doesn't install :/
#!pip install tables --since h5py can't be installed, neither can tables
import os
import re
import numpy as np
import pandas as pd
from plinkio import plinkfile
os.getcwd()
#working with original dataset
da... | github_jupyter |
# Transforming Images
```
#@ImageJ ij
image = ij.io().open("http://imagej.net/images/clown.png")
```
Image transformations such as rotation, scaling and cropping are accomplished using ops of the `transform` namespace.
Most ops of this namespace have the nice property of being _views_: they do not actually copy imag... | github_jupyter |
# Cross-Entropy Method
---
In this notebook, we will train the Cross-Entropy Method with OpenAI Gym's MountainCarContinuous environment.
### 1. Import the Necessary Packages
```
import gym
import math
import numpy as np
from collections import deque
import matplotlib.pyplot as plt
%matplotlib inline
import time
imp... | github_jupyter |
```
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import pyplot
import numpy as np
plt.rcParams.update({'figure.max_open_warning': 0})
df = pd.read_csv('\\Results_CSV\\Results_Transfer_Learning_Sim_to_Physical\\result_transfer_Sim_to_Phy_dijkstra_and_sha.csv')
df
ls = df['model_name']
ls
def conv... | github_jupyter |
### HomeWork 8
#### Mouselinos Spyridon
#### February 2020
***
### Exersize 2
***
```
### Imports
import numpy as np
import matplotlib.pyplot as plt
### Let's define the sigmoid function with scale a
def sigmoid(t,a):
return 1/(1+ np.exp(-a*t))
### a) Plot the function for different parameters of a
datapoints = ... | github_jupyter |
```
import os
import importlib.machinery
import importlib.util
loader = importlib.machinery.SourceFileLoader('baltic','/Users/evogytis/Documents/baltic/baltic.py')
spec = importlib.util.spec_from_loader(loader.name, loader)
bt = importlib.util.module_from_spec(spec)
loader.exec_module(bt)
base_path='/Users/evogytis/Do... | github_jupyter |
# Anacycliques
## Définition
Pour cet exercice, nous nous focaliserons sur une catégorie de mots qui conservent un sens lorsqu’on les lit de droite à gauche : les anacycliques. De la famille des anagrammes, ils se distinguent des palindromes en ce que leur sens n’est pas forcément identique dans les deux sens de lect... | github_jupyter |
This is an supervised classification example taken from the KDD 2009 cup. A copy of the data and details can be found here: [https://github.com/WinVector/PDSwR2/tree/master/KDD2009](https://github.com/WinVector/PDSwR2/tree/master/KDD2009). The problem was to predict account cancellation ("churn") from very messy data... | github_jupyter |
# Chapter 10: Sound Sharing and Retreival
## a) Create Audio Database
```
import os
import pandas as pd
import numpy as np
import freesound
from whoosh.fields import Schema, ID, TEXT, KEYWORD, NUMERIC
from whoosh.index import create_in
try:
from freesound_apikey import FREESOUND_API_KEY
except ImportError:
pri... | github_jupyter |
```
from datetime import date, timedelta
from Stock import *
s = date(2020,1,1)
e = date(2021,12,20)
tesla = Stock("tsla")
tesla.load_data()
#tesla.add_data_range(s,e,stockpath='pricedata/tsla.csv')
#tesla.save_data()
# adding individual days
#tesla.add_data(s)
len(tesla.df)
# Analysis
import seaborn as sns
import m... | github_jupyter |
# About: scpによるリストア
---
Moodle構築環境のデータ、設定ファイルなどのバックアップをscpを利用してリストアします。
## 概要
scpを利用してMoodle環境のリストアを行います。
### 前提条件
この Notebook を実行するには事前に以下のものを準備する必要があります。
* リストア対象のホストからバックアップ保存先のホストにSSH公開鍵認証でログインできること
* リストア先となるVCノード/EC2インスタンス/Azure仮想マシンが作成済であること
リストア先となる環境は「011-VCノードの作成」、「012-EC2インスタンスの作成」、「013-Azure仮想マシンの作成... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.