code
stringlengths
2.5k
150k
kind
stringclasses
1 value
### First steps The easiest way to run Python in your computer, is to install Anaconda: https://www.anaconda.com/download for your OS (Windows, macOS, Linux). Then from Anaconda's launcher you can run Jupyter notebook. This tutorial written in Jupyter notebooks. ### Magic hapenning here In Jupyter notebook, you can r...
github_jupyter
``` from birdcall.data import * from birdcall.metrics import * from birdcall.ops import * import torch import torchvision from torch import nn import numpy as np import pandas as pd from pathlib import Path import soundfile as sf BS = 16 MAX_LR = 1e-3 classes = pd.read_pickle('data/classes.pkl') splits = pd.read_pickl...
github_jupyter
# 作業 : (Kaggle)鐵達尼生存預測 https://www.kaggle.com/c/titanic # 作業1 * 參考範例,將鐵達尼的船票票號( 'Ticket' )欄位使用特徵雜湊 / 標籤編碼 / 目標均值編碼三種轉換後, 與其他數值型欄位一起預估生存機率 ``` # 做完特徵工程前的所有準備 (與前範例相同) import pandas as pd import numpy as np import copy, time from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import cross_val_...
github_jupyter
### What if we buy a share every day at the highest price? ``` import pandas as pd %matplotlib inline import matplotlib.pyplot as plt symbols = ['ABBV','AAPL','ADBE','APD','BRK-B','COST','CTL','DRI','IRM','KIM','MA','MCD','NFLX','NVDA','SO','V','VLO'] dates = ['2018-01-01', '2018-12-31'] data_directory = './data/hist...
github_jupyter
# 1. Loading and filtering data ``` import pandas as pd ``` ## 1.1. Firstly we load the data and filter the columns ``` df = pd.read_csv("/home/alberto/Documentos/MatchingLearning/Practicas/Moriarty2.csv", usecols=["UUID","ActionType"]) df2 = pd.read_csv("/home/alberto/Documentos/MatchingLearning/...
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
# Modeling and Simulation in Python Chapter 23 Copyright 2017 Allen Downey License: [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0) ``` # Configure Jupyter so figures appear in the notebook %matplotlib inline # Configure Jupyter to display the assigned value after an a...
github_jupyter
``` from IPython.display import Markdown as md import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline #from sklearn.linear_model import LogisticRegression #from sklearn.metrics import auc as sklearn_auc from sklearn.model_selection import train_test_split from s...
github_jupyter
# Logistic regression with $\ell_1$ regularization In this example, we use CVXPY to train a logistic regression classifier with $\ell_1$ regularization. We are given data $(x_i,y_i)$, $i=1,\ldots, m$. The $x_i \in {\bf R}^n$ are feature vectors, while the $y_i \in \{0, 1\}$ are associated boolean classes; we assume th...
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
<img src="imagenes/rn3.png" width="200"> <img src="http://www.identidadbuho.uson.mx/assets/letragrama-rgb-150.jpg" width="200"> # [Curso de Redes Neuronales](https://rn-unison.github.io) # Redes neuronales multicapa y el algoritmo de *b-prop* [**Julio Waissman Vilanova**](http://mat.uson.mx/~juliowaissman/), 27 de f...
github_jupyter
<a href="https://colab.research.google.com/github/arunk-vnk-chn/insaid-interview-questions/blob/master/20%20April%20-%20Introduction%20to%20Machine%20Learning%20(part%202).ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` ``` # 20 April – Introd...
github_jupyter
# Image Captioning with LSTMs In the previous exercise you implemented a vanilla RNN and applied it to image captioning. In this notebook you will implement the LSTM update rule and use it for image captioning. ``` # As usual, a bit of setup import time, os, json import numpy as np import matplotlib.pyplot as plt fro...
github_jupyter
# Part 3: Advanced Remote Execution Tools In the last section we trained a toy model using Federated Learning. We did this by calling .send() and .get() on our model, sending it to the location of training data, updating it, and then bringing it back. However, at the end of the example we realized that we needed to go...
github_jupyter
# Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code, but left the implementation of the neural network up to you (for the most part). After you've submitted this project, feel free to explore the data and...
github_jupyter
# Tutorial 3 of 3: Advanced Topics and Usage **Learning Outcomes** * Use different methods to add boundary pores to a network * Manipulate network topology by adding and removing pores and throats * Explore the ModelsDict design, including copying models between objects, and changing model parameters * Write a custom...
github_jupyter
## What is convolution and how it works ? [Convolution][1] is the process of adding each element of the image to its local neighbors, weighted by the [kernel][2]. A kernel, convolution matrix, filter, or mask is a small matrix. It is used for blurring, sharpening, embossing, edge detection, and more. This is accomplis...
github_jupyter
<a href="https://colab.research.google.com/github/DingLi23/s2search/blob/pipelining/pipelining/exp-cshc/exp-cshc_cshc_1w_ale_plotting.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ### Experiment Description > This notebook is for experiment \<ex...
github_jupyter
# SAX circuit simulator [SAX](https://flaport.github.io/sax/) is a circuit solver written in JAX, writing your component models in SAX enables you not only to get the function values but the gradients, this is useful for circuit optimization. This tutorial has been adapted from SAX tutorial. Note that SAX does not w...
github_jupyter
``` from torchvision.models import * import wandb from sklearn.model_selection import train_test_split import os,cv2 import numpy as np import matplotlib.pyplot as plt from torch.optim import * from torch.nn import * import torch,torchvision from tqdm import tqdm device = 'cuda' PROJECT_NAME = 'Musical-Instruments-Imag...
github_jupyter
# (Optional) Testing the Function Endpoint with your Own Audio Clips Instead of using pre-recorded clips we show you in this notebook how to invoke the deployed Function with your **own** audio clips. In the cells below, we will use the [PyAudio library](https://pypi.org/project/PyAudio/) to record a short 1 second...
github_jupyter
![Logo_unad](https://upload.wikimedia.org/wikipedia/commons/5/5f/Logo_unad.png) <font size=3 color="midnightblue" face="arial"> <h1 align="center">Escuela de Ciencias Básicas, Tecnología e Ingeniería</h1> </font> <font size=3 color="navy" face="arial"> <h1 align="center">ECBTI</h1> </font> <font size=2 color="darkor...
github_jupyter
# Interdisciplinary Health Data Competition - Data Cleaning ## Import necessary libraries ``` import pandas as pd import numpy as np import warnings ``` ## Agenda Step 1 - Read in Data Files - Read in drug and prescription files - Inspect their initial format - Inspect their initial data types - Inspect data distri...
github_jupyter
# Import Libraries ``` import nltk from nltk.corpus import stopwords from nltk.tokenize import word_tokenize, sent_tokenize ``` # Sentences ``` sentence = [("the", "DT"), ("little", "JJ"), ("yellow", "JJ"),("dog", "NN"), ("barked", "VBD"), ("at", "IN"), ("the", "DT"), ("cat", "NN")] sentence2 = "Four score and sev...
github_jupyter
<a href="https://colab.research.google.com/github/shivangisachan20/ML-DL-Projects/blob/master/Copy_of_pytorch_quick_start.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # PyTorch 1.2 Quickstart with Google Colab In this code tutorial we will learn ...
github_jupyter
# Talking Head Anime from a Single Image 2: More Expressive (Manual Poser Tool) **Instruction** 1. Run the four cells below, one by one, in order by clicking the "Play" button to the left of it. Wait for each cell to finish before going to the next one. 2. Scroll down to the end of the last cell, and play with the GU...
github_jupyter
``` %matplotlib inline %load_ext autoreload %autoreload 2 from __future__ import division from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from scipy.st...
github_jupyter
# Notebook example Installing some necessary packages: ``` !pip install ipywidgets !jupyter nbextension enable --py widgetsnbextension !jupyter labextension install @jupyter-widgets/jupyterlab-manager !pip install xgboost ``` **It is necessary to change the working directory so the project structure works properly:*...
github_jupyter
# Segregation Index Decomposition ## Table of Contents * [Decomposition framework of the PySAL *segregation* module](#Decomposition-framework-of-the-PySAL-*segregation*-module) * [Map of the composition of the Metropolitan area of Los Angeles](#Map-of-the-composition-of-the-Metropolitan-area-of-Los-Angeles) * [Map o...
github_jupyter
# Visualising PAG neurons in CCF space In this notebook we will load the .csv file containing the metadata from our PAG_scRNAseq project and use the CCF coordinates obtained after registration with Sharp-Track to visualise our sequenced cells with Brainrender. We will also write some code to generate some figures for t...
github_jupyter
``` import numpy as np from matplotlib import pyplot as plt %matplotlib # if you are plotting at the rig computer and want to plot the last debugging # run images, set this to True. plot_at_rig = True processed_is_CDS_subtracted = True # whether to halve the processed_img size # to help explore possible settings resh...
github_jupyter
# Introduction to Digital Earth Australia <img align="right" src="../Supplementary_data/dea_logo.jpg"> * **Acknowledgement**: This notebook was originally created by [Digital Eath Australia (DEA)](https://www.ga.gov.au/about/projects/geographic/digital-earth-australia) and has been modified for use in the EY Data Scie...
github_jupyter
#Given a budget of 30 million dollar (or less) and genre, can I predict gross domestic profit using linear regression? ``` %matplotlib inline import pickle from pprint import pprint import pandas as pd import numpy as np from dateutil.parser import parse import math # For plotting import seaborn as sb import matplotli...
github_jupyter
## Import a model from ONNX and run using PyTorch We demonstrate how to import a model from ONNX and convert to PyTorch #### Imports ``` import os import operator as op import warnings; warnings.simplefilter(action='ignore', category=FutureWarning) import numpy as np import torch from torch import nn from torch.nn...
github_jupyter
# Credit Risk Classification Credit risk poses a classification problem that’s inherently imbalanced. This is because healthy loans easily outnumber risky loans. In this Challenge, you’ll use various techniques to train and evaluate models with imbalanced classes. You’ll use a dataset of historical lending activity fr...
github_jupyter
<a href="https://colab.research.google.com/github/LeonVillanueva/CoLab/blob/master/Google_CoLab_DL_Recommender.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ### Loading Libraries ``` !pip install -q tensorflow==2.0.0-beta1 %%capture import numpy ...
github_jupyter
# Building Simple Neural Networks In this section you will: * Import the MNIST dataset from Keras. * Format the data so it can be used by a Sequential model with Dense layers. * Split the dataset into training and test sections data. * Build a simple neural network using Keras Sequential model and Dense layers. * Tra...
github_jupyter
``` from PIL import Image import numpy as np import matplotlib.pyplot as plt from scipy import stats import math %matplotlib inline ``` # Volunteer 1 ## 3M Littmann Data ``` image = Image.open('3Ms.bmp') image x = image.size[0] y = image.size[1] print(x) print(y) matrix = [] points = [] integrated_density = 0 for i...
github_jupyter
``` #Set working directory import os path="/Users/sarakohnke/Desktop/data_type_you/processed-final/" os.chdir(path) os.getcwd() #Import required packages import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline #Import cleaned dataframe dataframe=...
github_jupyter
``` %matplotlib inline from pyvista import set_plot_theme set_plot_theme('document') ``` Volumetric Analysis =================== Calculate mass properties such as the volume or area of datasets ``` # sphinx_gallery_thumbnail_number = 4 import numpy as np from pyvista import examples ``` Computing mass properties su...
github_jupyter
# Exemplo sobre a correlação cruzada A correlação cruzada é definida por \begin{equation} R_{xy}(\tau)=\int_{-\infty}^{\infty}x(t)y(t+\tau)\mathrm{d} t \tag{1} \end{equation} Considerede um navio a navegar por águas não muito conhecidas. Para navegar com segurança, o navio necessita ter uma noção da profundidade da ...
github_jupyter
## Vehicle Detection ### Import Import of the used packages. ``` import numpy as np import os import cv2 import pickle import glob import matplotlib.image as mpimg import matplotlib.pyplot as plt from moviepy.editor import VideoFileClip from IPython.display import HTML from skimage.feature import hog import time fro...
github_jupyter
``` #Python Basics #Functions in Python #Functions take some inputs, then they produce some outputs #The functions are just a piece of code that you can reuse #You can implement your functions, but in many cases, people reuse other people's functions #in this case, it is important how the function work and how we can i...
github_jupyter
# Navigation --- Congratulations for completing the first project of the [Deep Reinforcement Learning Nanodegree](https://www.udacity.com/course/deep-reinforcement-learning-nanodegree--nd893)! In this notebook, you will learn how to control an agent in a more challenging environment, where it can learn directly from...
github_jupyter
``` # Imports from biocrnpyler import * from genelet import * from subsbml import System, createSubsystem, combineSystems, createNewSubsystem, createBasicSubsystem, SimpleModel, SimpleReaction import numpy as np import pylab as plt from bokeh.layouts import row from bokeh.io import export_png import warnings import l...
github_jupyter
## 3. Exploring data tables with Pandas 1. Use Pandas to read the house prices data. How many columns and rows are there in this dataset? 2. The first step I usually do is to use commands like pandas.head() to print a few rows of data. Look around what kind of features are available and read data description.txt for m...
github_jupyter
``` #Import section import numpy as np import cv2 import glob import matplotlib.pyplot as plt import pickle %matplotlib inline # Loading camera calibration coefficients(matrix and camera coefficients) from pickle file def getCameraCalibrationCoefficientsFromPickleFile(filePath): cameraCalibration = pickle.load( ope...
github_jupyter
``` import numpy as np import re import pandas as pd from sklearn.preprocessing import StandardScaler, MinMaxScaler from sklearn.decomposition import PCA from sklearn.cluster import KMeans, DBSCAN from sklearn.neighbors import NearestNeighbors from requests import get import unicodedata from bs4 import BeautifulSoup im...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '' import tensorflow as tf import numpy as np from glob import glob from itertools import cycle mels = glob('universal-mel/*.npy') file_cycle = cycle(mels) f = next(file_cycle) path = 'hifigan-512-combined' ckpt_path = tf.train.latest_checkpoint(path) ckpt_path def g...
github_jupyter
# Import and convert Neo23x0 Sigma scripts ianhelle@microsoft.com This notebook is a is a quick and dirty Sigma to Log Analytics converter. It uses the modules from sigmac package to do the conversion. Only a subset of the Sigma rules are convertible currently. Failure to convert could be for one or more of these rea...
github_jupyter
## This notebook shows how to run evaluation on our models straight from Colab environment ``` # mount GD from google.colab import drive drive.mount('/content/drive') # your GD path to clone the repo project_path="/content/drive/MyDrive/UofT_MEng/MIE1517/Project/FINDER_github/" # Clone repo %cd {project_path} !git c...
github_jupyter
``` %matplotlib inline import re import time import numpy as np import pandas as pd import matplotlib.pyplot as plt from numpy import nan from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.support.wait import WebDriverWait ## create a pandas dataframe...
github_jupyter
``` %pushd ../../ %env CUDA_VISIBLE_DEVICES=3 import json import os import sys import tempfile from tqdm.auto import tqdm import torch import torchvision from torchvision import transforms from PIL import Image import numpy as np torch.cuda.set_device(0) from netdissect import setting segopts = 'netpqc' segmodel, se...
github_jupyter
# How do distributions transform under a change of variables ? Kyle Cranmer, March 2016 ``` %pylab inline --no-import-all ``` We are interested in understanding how distributions transofrm under a change of variables. Let's start with a simple example. Think of a spinner like on a game of twister. <!--<img src="ht...
github_jupyter
# Introduction to Docker **Learning Objectives** * Build and run Docker containers * Pull Docker images from Docker Hub and Google Container Registry * Push Docker images to Google Container Registry ## Overview Docker is an open platform for developing, shipping, and running applications. With Docker, you can...
github_jupyter
``` # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O...
github_jupyter
[<img src="https://deepnote.com/buttons/launch-in-deepnote-small.svg">](https://deepnote.com/launch?url=https%3A%2F%2Fgithub.com%2Fgordicaleksa%2Fget-started-with-JAX%2Fblob%2Fmain%2FTutorial_4_Flax_Zero2Hero_Colab.ipynb) <a href="https://colab.research.google.com/github/gordicaleksa/get-started-with-JAX/blob/main/Tut...
github_jupyter
``` import numpy as np import scipy from scipy.linalg import expm import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler, MinMaxScaler from sklearn.decomposition import PCA...
github_jupyter
``` # Загрузка зависимостей import numpy as np import pandas as pd import matplotlib.pyplot as plt import keras from keras.models import Sequential from keras.layers import Dense from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import MinMaxScaler from sklearn.model_selection import train_tes...
github_jupyter
``` #Importing libraries import tensorflow as tf from tensorflow import keras import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import numpy as np from sklearn.metrics import classification_report #Setting the visualization %matplotlib inline %config InlineBackend.figur...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') !pip3 install glove_python import os os.chdir('/content/drive/MyDrive/sharif/DeepLearning/ipython(guide)') import numpy as np import codecs import os import random import pandas from keras import backend as K from keras.models import Model from keras.laye...
github_jupyter
(code-advcd-best-practice)= # Tools for Better Coding ## Introduction This chapter covers the tools that will help you to write better code. This includes practical topics such as debugging code, logging, linting, and the magic of auto-formatting. As ever, you may need to `conda install packagename` or `pip install ...
github_jupyter
``` import warnings warnings.filterwarnings("ignore") import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt plt.style.use('ggplot') import torch print(torch.__version__) import torch.nn as nn import torch.optim as optim import torch.utils.data as data_utils from torch.utils.d...
github_jupyter
``` # Initialize Otter Grader import otter grader = otter.Notebook() ``` ![data-x](https://raw.githubusercontent.com/afo/data-x-plaksha/master/imgsource/dx_logo.png) # In-class Assignment (Feb 9) Run the following two cells to load the required modules and read the data. ``` import pandas as pd import numpy as np ...
github_jupyter
# SLU10 - Classification: Exercise notebook ``` import pandas as pd import numpy as np ``` In this notebook you will practice the following: - What classification is for - Logistic regression - Cost function - Binary classification You thought that you would get away without implementing your ...
github_jupyter
<a href="https://colab.research.google.com/github/adasegroup/ML2022_seminars/blob/master/seminar1/seminar01.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Seminar 1. Machine learning on Titanic data The notebook provides an intro to the explorat...
github_jupyter
# PTN Template This notebook serves as a template for single dataset PTN experiments It can be run on its own by setting STANDALONE to True (do a find for "STANDALONE" to see where) But it is intended to be executed as part of a *papermill.py script. See any of the experimentes with a papermill script to get sta...
github_jupyter
``` import pandas as pd from os.path import join data_path = "../Dataset-1/selfie_dataset.txt"#join("..", "..", "Dataset-1", "selfie_dataset.txt") image_path = "../Dataset-1/images"#join("..", "..", "Dataset-1", "selfie_dataset.txt")#join("..", "..", "Dataset-1", "images") headers = [ "image_name", "score", "partia...
github_jupyter
# Railroad Diagrams The code in this notebook helps with drawing syntax-diagrams. It is a (slightly customized) copy of the [excellent library from Tab Atkins jr.](https://github.com/tabatkins/railroad-diagrams), which unfortunately is not available as a Python package. **Prerequisites** * This notebook needs some ...
github_jupyter
# **Jupyter Notebook to demonstrate (simple) Linear Regression for Advertising/Sales Predicition** Linear Regression is a simple yet powerful and mostly used algorithm in data science. There are a plethora of real-world applications of Linear Regression. The purpose of this tutorial/notebook is to get a clear idea on...
github_jupyter
``` # Copyright 2020 Google LLC. 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 ...
github_jupyter
# Project Euler Problems 1 and 2 > Multiples of 3 or 5 and even Fibonacci numbers in Python - toc: false - badges: true - comments: true - categories: [euler, programming] In order to stay fresh with general programming skills I am going to attempt various Project Euler problems and walk through my solutions. For th...
github_jupyter
<a href="https://colab.research.google.com/github/ginttone/test_visuallization/blob/master/2_T_autompg_xgboost.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## 데이터 로딩 ``` import pandas as pd df = pd.read_csv('./auto-mpg.csv', header=None) df.colu...
github_jupyter
##### Load the data to dataframes ``` from pathlib import Path import pandas as pd %run util.ipynb from termcolor import colored file_april_2020_parent_address = "../Data/ProlificAcademic/April 2020/Data/CRISIS_Parent_April_2020.csv" file_april_2020_adult_address = "../Data/ProlificAcademic/April 2020/Data/CRISIS_Adu...
github_jupyter
# Distributed Training with Keras ## Import dependencies ``` import tensorflow_datasets as tfds import tensorflow as tf from tensorflow import keras import os print(tf.__version__) ``` ## Dataset - Fashion MNIST ``` #datasets, info = tfds.load(name='mnist', with_info=True, as_supervised=True) #mnist_train, mnist_t...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np import pandas as pd ``` Manually Principal Component Analysis ``` #Reading wine data df_wine = pd.read_csv('https://archive.ics.uci.edu/ml/' 'machine-learning-databases/wine/wine.data', header=None) # in the data first...
github_jupyter
``` import os, shutil, csv original_dataset_dir = '/Users/mithyyin/Documents/GitHub/TeamEve/Classfication_small_datasets_inception_v3/waste_original_dataset' #directory name of your biendata #original_dataset_dir =r'C:\Users\oscarscaro\Documents\GitHub\TeamEve\Classfication_small_datasets_inception_v3\images_withoutre...
github_jupyter
# Problem Statement ## About Company Company deals in all home loans. They have presence across all urban, semi urban and rural areas. Customer first apply for home loan after that company validates the customer eligibility for loan. ## Problem Company wants to automate the loan eligibility process (real time) based...
github_jupyter
# Run a batch of samples on the HPC cluster This experiment is part of a series which should help us validate the Kingston, ON model. ## Set-up orchistration and compute environments To set-up access to the remote compute server: 1. On the local host generate keys: ``` ssh-keygen -t rsa ``` 1. Copy those keys to ...
github_jupyter
# Monte Carlo Methods In this notebook, you will write your own implementations of many Monte Carlo (MC) algorithms. While we have provided some starter code, you are welcome to erase these hints and write your code from scratch. ### Part 0: Explore BlackjackEnv We begin by importing the necessary packages. ``` i...
github_jupyter
# Narowcast Server service migration to Distribution Services ## 1. Getting data from NC ### 1.1 List of NC Services ``` # Run this SQL code against Narrocast Server database """ select names1.MR_OBJECT_ID AS serviceID, names1.MR_OBJECT_NAME AS service_name, parent1.MR_OBJECT_NAME AS foldername, names2.MR_OBJECT...
github_jupyter
# High-level Keras (Theano) Example ``` # Lots of warnings! # Not sure why Keras creates model with float64? %%writefile ~/.theanorc [global] device = cuda0 force_device= True floatX = float32 warn_float64 = warn import os import sys import numpy as np os.environ['KERAS_BACKEND'] = "theano" import theano import keras ...
github_jupyter
``` from sqlalchemy import create_engine import pandas as pd import matplotlib.pyplot as plot import json import pymysql import statsmodels.formula.api as sm from sklearn.cross_validation import train_test_split from sklearn import metrics from sklearn.cross_validation import cross_val_score from collections import Ord...
github_jupyter
### 6. Python API Training - Continuous Model Training [Solution] <b>Author:</b> Thodoris Petropoulos <br> <b>Contributors:</b> Rajiv Shah This is the 6th exercise to complete in order to finish your `Python API Training for DataRobot` course! This exercise teaches you how to deploy a trained model, make predictions ...
github_jupyter
##### Copyright 2019 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 pandas as pd df = pd.read_csv('X.txt',sep=',') df.head() df.收益率 = df.收益率.str.strip(to_strip='%') df.head() df.sort_values(by=['收益率','天数','车型','城市车商','众筹金额'],ascending=False).head() df.to_csv('X.csv',index=False,encoding='utf8') df.info() df.城市车商.value_counts() df[(df.城市车商.str[0]>=u'\u4e00') & (df.城市车商.str[0]...
github_jupyter
<div> <img src="figures/svtLogo.png"/> </div> <h1><center>Mathematical Optimization for Engineers</center></h1> <h2><center>Lab 14 - Uncertainty</center></h2> We want to optimize the total annualized cost of a heating and electric power system. Three different technologies are present: - a gas boiler - a combined hea...
github_jupyter
``` import os import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data ``` 注意点: - b 零初始值 - w 初始化要用 tf,不要用 np ``` # 读取数据集MNIST,并放在当前目录data文件夹下MNIST文件夹中,如果该地址没有数据,则下载数据至该文件夹 # 一张图片有 28*28=784 个像素点,每个...
github_jupyter
``` import pickle import numpy as np import collections import matplotlib.pyplot as plt import copy import matplotlib.ticker as ticker import mpmath as mp from mpmath import gammainc def power_law(x,s_min, s_max, alpha): C = ((1-alpha)/(s_max**(1-alpha)-s_min**(1-alpha))) return [C*x[i]**(-alpha) for i in range...
github_jupyter
# TensorFlow Tutorial #02 # Convolutional Neural Network These lessons are adapted from [tutorials](https://github.com/Hvass-Labs/TensorFlow-Tutorials) by [Magnus Erik Hvass Pedersen](http://www.hvass-labs.org/) / [GitHub](https://github.com/Hvass-Labs/TensorFlow-Tutorials) / [Videos on YouTube](https://www.youtube.c...
github_jupyter
Assessment Requirements Each group is required to complete the following two tasks: 1. Generate a sparse representation for Paper Bodies (i.e. paper text without Title, Authors, Abstract and References). The sparse representation consists of two files: a. Vocabulary index file b. Sparse count vectors file 2. Gener...
github_jupyter
# Python Strings - Strings is one of the most important data types. - Let's know how it is declared, defined, accessed and common operations performed on the python strings. ## Strings - A string is a collection or series of characters. - An important point to remember is that python strings are **immutable**. Once,...
github_jupyter
# Visualize gene expression This notebook visualizes the gene expression data for the template and simulated experiments in order to: 1. Validate that the structure of the gene expression data and simulated data are consistent 2. To visualize the signal that is in the experiments ``` %load_ext autoreload %load_ext rp...
github_jupyter
##### Copyright 2019 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
# Regression, body and brain ## About this page This is a Jupyter Notebook. It can be run as an interactive demo, or you can read it as a web page. You don't need to understand the code on this page, the text will tell you what the code is doing. You can also [run this demo interactively](https://mybinder.org/v2/g...
github_jupyter
# Retraining of top performing FFNN ## Imports ``` # General imports import sys import os sys.path.insert(1, os.path.join(os.pardir, 'src')) from itertools import product # Data imports import cv2 import torch import mlflow import numpy as np from mlflow.tracking.client import MlflowClient from torchvision import ...
github_jupyter
## Face and Facial Keypoint detection After you've trained a neural network to detect facial keypoints, you can then apply this network to *any* image that includes faces. The neural network expects a Tensor of a certain size as input and, so, to detect any face, you'll first have to do some pre-processing. 1. Detect...
github_jupyter
``` 2+2 answer = 2+2 print(answer) new_variable = 9 new_variable = 6 print(new_variable) ``` This ia markdown cell # This is a heading My program is awesome ``` import numpy data = numpy.loadtxt(fname='data/inflammation-01.csv',delimiter=',') print(data) print(type(data[0,0])) print(data.dtype) print(data.shape) pr...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import pandas as pd from numpy.linalg import inv from astropy.table import Table, Column, vstack, hstack, unique, SortedArray,SCEngine import astropy.units as u from astropy.io import fits, ascii import glob import os import numpy from scipy.signal import med...
github_jupyter
This notebook is scratch space for some relatively simple tweaks I'm making to ScienceBase Items in the NDC in order to better position the system for building new data indexing code against. It requires authentication for using the sciencebasepy package (in PyPI) to write changes to ScienceBase. ``` import sciencebas...
github_jupyter