code
stringlengths
2.5k
150k
kind
stringclasses
1 value
# Optical Data Reduction using Python by Steve Crawford (South African Astronomical Observatory) ``` %matplotlib inline %load_ext autoreload %autoreload 2 ``` In addition to instrument specific python pipelines, there now exists a suite of tools available for general reduction of optical observations. This includes...
github_jupyter
------ # **Dementia Patients -- Analysis and Prediction** ### ***Author : Akhilesh Vyas*** ### ****Date : August, 2019**** # ***Result Plots*** - <a href='#00'>0. Setup </a> - <a href='#00.1'>0.1. Load libraries </a> - <a href='#00.2'>0.2. Define paths </a> - <a href='#01'>1. Data Preparation </a> - <a...
github_jupyter
HMMs Library ============================ #### (Discrete & Continuous hidden markov models ) The document contain the tutorial ( usage explained by example ) for the hidden markov models library [link to pip]. * [The **first** part](#dthmm) will cover disrete-time hidden markov model (**DtHMM**) * [The **second** par...
github_jupyter
# Notebook 13: Using Deep Learning to Study SUSY with Pytorch ## Learning Goals The goal of this notebook is to introduce the powerful PyTorch framework for building neural networks and use it to analyze the SUSY dataset. After this notebook, the reader should understand the mechanics of PyTorch and how to construct D...
github_jupyter
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-59152712-8"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-59152712-8'); </script> # Start-to-Finish Example: Setting up Exact Initial Data fo...
github_jupyter
## Silicon above 15 m ``` import datetime as dt import matplotlib.pyplot as plt from matplotlib.colors import LogNorm import numpy as np import pandas as pd import statsmodels.api as sm import xarray as xr foramt = "{:.2}" myformat = {'bias': foramt, 'rmse': foramt, 'swillmott': foramt, 'slopedev': foramt, 'const': fo...
github_jupyter
# Archived code This notebook contains code for variables that I removed from the model. ## Previous Week Averages Note: in add_pwa first pwa columns are removed twice when calculating pwa for t and co ``` # function for calculating the pwa of a column (excludes the day measured in the t and co columns) def calc_pwa...
github_jupyter
# Baseline Model - Initial parameters search. - Search parameter for baseline model. #### Author: Israel Oliveira [\[e-mail\]](mailto:'Israel%20Oliveira%20'<prof.israel@gmail.com>) ``` %load_ext watermark import pandas as pd import numpy as np from sklearn.model_selection import train_test_split, ParameterGrid fr...
github_jupyter
# Node classification with Graph ATtention Network (GAT) <table><tr><td>Run the latest release of this notebook:</td><td><a href="https://mybinder.org/v2/gh/stellargraph/stellargraph/master?urlpath=lab/tree/demos/node-classification/gat-node-classification.ipynb" alt="Open In Binder" target="_parent"><img src="https:/...
github_jupyter
# State preparation with the SLM mask ## Basics When performing quantum computations with global pulses, it might be hard to prepare the system in an arbitrary initial state. This is especially true in the XY mode, where only a global $\sigma^x$ pulse can produce excitations whose number is otherwise conserved during...
github_jupyter
``` # general imports import random import numpy as np from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.utils.data as utils import matplotlib.pyplot as plt plt.rcParams["legend.l...
github_jupyter
##### Copyright 2020 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 # 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 agreed to in writ...
github_jupyter
``` import numpy as np import pandas as pd %load_ext autoreload %autoreload 2 ``` # Overview What does this thing look like? - Object that you can import - Can call train, load, featurize, import - Inherits from sklearn.transform? Multiple inheritance is hard... # I. Load Data - words: np.ndarray of all characters ...
github_jupyter
``` from PIL import Image from matplotlib import pyplot as plt %matplotlib notebook import seaborn as sns import os import sys sys.path.append("..") import numpy as np from tensorflow.keras.preprocessing import image_dataset_from_directory from tensorflow.keras.preprocessing import image from tensorflow.keras.applicat...
github_jupyter
# Deep Learning on JuiceFS Tutorial - 01. Getting Started JuiceFS is a shared POSIX file system for the cloud. You may replace existing solutions with JuiceFS with zero cost, turns any object store into a shared POSIX file system. Sign up for 1T free quota now at https://juicefs.com Source code of this tutorial can...
github_jupyter
``` import numpy as np import pandas as pd import seaborn as sns import matplotlib.pylab as plt # Draw u from Gaussian(0,1), i = 1,...,10 (unknown to agent) # arms = number of possible of actions (known to agent) arms = 10 u = np.random.randn(arms,1) # Rewards of action i at time t => x_i(t) ~ N(u_i,1) # x_i(t) is i...
github_jupyter
# Cocco, Gomes, and Maenhout (2005) # "[Consumption and Portfolio Choice Over the Life Cycle](https://academic.oup.com/rfs/article-abstract/18/2/491/1599892)" - Notebook created by Matt Zahn ## Summary This paper uses a realistically calibrated model of consumption and portfolio choice with non-tradable assets and ...
github_jupyter
[source](../../api/alibi_detect.cd.mmd_online.rst) # Online Maximum Mean Discrepancy ## Overview The online [Maximum Mean Discrepancy (MMD)](http://jmlr.csail.mit.edu/papers/v13/gretton12a.html) detector is a kernel-based method for online drift detection. The MMD is a distance-based measure between 2 distributions ...
github_jupyter
# Thermal data exploration notebook *Author: Giulia Mazzotti - heavily relying on Steven Pestana's amazing Thermal IR tutorials!* ### Main goal - scientific On February 8th, airborne thermal IR data was acquired over the Grand Mesa domain during multiple overpasses. The goal of this notebook isto kick off working...
github_jupyter
#Classes Variables, Lists, Dictionaries etc in python is a object. Without getting into the theory part of Object Oriented Programming, explanation of the concepts will be done along this tutorial. A class is declared as follows class class_name: Functions ``` class FirstClass: pass ``` **pass** in pyth...
github_jupyter
# Decision Tree Classification And Regression Trees (CART for short) is a term introduced by [Leo Breiman](https://en.wikipedia.org/wiki/Leo_Breiman) to refer to Decision Tree algorithms that can be used for classification or regression predictive modeling problems. In this lab assignment, you will implement various ...
github_jupyter
# Probability theory ## Random experiment When we toss an unbiased coin, we say that it lands heads up with probability $\frac{1}{2}$ and tails up with probability $\frac{1}{2}$. Such a coin toss is an example of a **random experiment** and the set of **outcomes** of this random experiment is the **sample space** $\...
github_jupyter
# Train word2vec locally This allows a smart initialization of our neural net's word embeddings. It seems that initializing the embeddings by training them locally, as opposed to using pre-trained word2vec embeddings (available online) can lead to better performance. ``` import os import sys print(sys.executable) fro...
github_jupyter
# NLP 2 - Pré Processamento de Textos e Modelos Modernos Fala galera! Na aula passada, tivemos uma introdução ao mundo de NLP: o modelo BoW (Bag of Words) e o algoritmo TF-iDF. Embora muito práticos, observamos alguns fenômenos de NLP e dessas técnicas: - NLP é naturalmente um problema de grandes dimensionalidades, o...
github_jupyter
# Developing Custom Models Panel ships with a number of custom Bokeh models, which have both Python and Javascript components. When developing Panel these custom models have to be compiled. This happens automatically with `pip install -e .` or `python setup.py develop`, however when runnning actively developing you ca...
github_jupyter
``` from IPython.display import Markdown as md ### change to reflect your notebook _nb_loc = "07_training/07a_ingest.ipynb" _nb_title = "Writing an efficient ingest Loop" ### no need to change any of this _nb_safeloc = _nb_loc.replace('/', '%2F') md(""" <table class="tfo-notebook-buttons" align="left"> <td> <a ...
github_jupyter
### <font color = "darkblue">Updates to Assignment</font> #### If you were working on the older version: * Please click on the "Coursera" icon in the top right to open up the folder directory. * Navigate to the folder: Week 3/ Planar data classification with one hidden layer. You can see your prior work in version...
github_jupyter
``` # This Youtube video walks through this notebook from IPython.display import YouTubeVideo YouTubeVideo('cvVl1lQ4agU') ``` # Tests on PDA ``` from jove.SystemImports import * from jove.DotBashers import * from jove.Def_md2mc import * from jove.Def_PDA import * pdaDyck = md2mc('''PDA IF : (, #; (# -...
github_jupyter
# Day 16-17: Urban/Rural - Land I need to catch up... This won't be the most artistic day, but I would find it useful in my life to have code that downloads GHSL datasets and plots them. ## Configuration ``` import os import rioxarray import matplotlib.pyplot as plt import matplotlib.colors as colors %matplotlib i...
github_jupyter
``` import arff import numpy as np import pandas as pd import os import subprocess import matplotlib.pyplot as plt import re from sklearn.metrics import accuracy_score from sklearn.decomposition import PCA from sklearn.pipeline import make_pipeline from sklearn.preprocessing import StandardScaler df1 = pd.read_csv('/ho...
github_jupyter
# Parsing San Jose PD's firearm search reports This example uses `pdfplumber`'s visual debugging and text-extraction features to parse a fixed-width table embedded in a PDF. Thanks to [Ron Campbell](https://twitter.com/campbellronaldw) for the sample PDF. ``` import pdfplumber import re print(pdfplumber.__version__) ...
github_jupyter
## OOP A programming paradigm that provides a means of structuring programs so that properties and behaviors are bundled into individual objects. Pros: * code modularisation thus ease in troubleshooting. * reuse of code through inheritance. * flexibility through polymorphism (multiple usage). ### 1. Class Definition ...
github_jupyter
#### Copyright 2020 Google LLC. ``` # 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 agreed to in writin...
github_jupyter
# openvino2tensorflow This tutorial explains the use case of openvino2tensorflow while using arachne. `openvino2tensorflow` is developed in the following GitHub repository. https://github.com/PINTO0309/openvino2tensorflow When you convert onnx model to tensorflow model by `onnx-tf`, the converted model includes ...
github_jupyter
<center> <img src="https://gitlab.com/ibm/skills-network/courses/placeholder101/-/raw/master/labs/module%201/images/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # **Hands-on Lab : Web Scraping** Estimated time needed: **30 to 45** minutes ## Objectives In this lab you will perform the fo...
github_jupyter
# 处理数据 数据是构建机器学习模型的基础。在云中集中管理数据,并使在多个工作站上运行试验和训练模型的数据科学家团队能够访问这些数据以及计算目标,这是任何专业数据科学解决方案的重要组成部分。 在该笔记本中,你将探索两个用于数据处理的 Azure 机器学习对象:数据存储和数据集。 ## 连接到工作区 首先,请连接到你的工作区。 > **备注**:如果尚未与 Azure 订阅建立经过身份验证的会话,则系统将提示你通过执行以下操作进行身份验证:单击链接,输入验证码,然后登录到 Azure。 ``` import azureml.core from azureml.core import Workspace #...
github_jupyter
<div class="alert alert-block alert-info" style="margin-top: 20px"> <a href="https://cocl.us/PY0101EN_edx_add_top"> <img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/PY0101EN/Ad/TopAd.png" width="750" align="center"> </a> </div> <a href="https://cognitiveclass....
github_jupyter
``` import pandas as pd import numpy as np import os from xml.etree import cElementTree as ET from dbfread import DBF import time import sqlite3 os.getcwd() os.chdir("/Users/ninarethaller/Downloads/") ``` Les année d'élection : 1965 1969 1974 1981 1988 1995 2002 2007 2012 2017 Pour 2017, on utilise la date la plus pr...
github_jupyter
``` !pip install git+https://github.com/zhy0/dmarket_rl !pip install ray[rllib] import pandas as pd import numpy as np import matplotlib.pyplot as plt from dmarket.environments import MultiAgentTrainingEnv from dmarket.info_settings import OfferInformationSetting, BlackBoxSetting from dmarket.agents import GymRLAgent ...
github_jupyter
# Ingest Text Data Labeled text data can be in a structured data format, such as reviews for sentiment analysis, news headlines for topic modeling, or documents for text classification. In these cases, you may have one column for the label, one column for the text, and sometimes other columns for attributes. You can tr...
github_jupyter
## VQE ansatz: 001 ``` import os import numpy import pennylane as qml from pennylane import numpy as np from pennylane.optimize import AdamOptimizer, GradientDescentOptimizer import sys sys.path.append("..") from wordsToNumbers import Corpus from wordsToNumbers import fibonacci_vocabulary from wordsToQubits impor...
github_jupyter
# New Style HDMI input and Pixel Formatting This notebook introduces the new features of PYNQ 2.0 for interacting with the video pipeline. The API has been completely redesigned with high performance image processing applications in mind. To start, download the base overlay and instantiate the HDMI input and output. ...
github_jupyter
## Deep Learning Regularization 😓Be well prepared that when the code worked for me, may not work for you any more. It took me so much time tonight to debug, upgrade/install packages, change deprecated functions or just ignore warnings.... All because of the frequent changes in these open source packages. So, when it'...
github_jupyter
### Maricopa Agricultural Center Season 6 ### Citation for Input Trait Data LeBauer, David et al. (2020), Data From: TERRA-REF, An open reference data set from high resolution genomics, phenomics, and imaging sensors, v6, Dryad, Dataset, https://doi.org/10.5061/dryad.4b8gtht99 ##### Environmental weather data can be...
github_jupyter
# Exploring Observation Data From TILDE, Application to DART Data ## &nbsp;Table of contents ### 1. Introduction ### 2. Building a Query for a specific sensor code/stream ### 3. Building a Query without sensor code/stream ### 4. Building a Query for the latest data ### 5. Building a Query for aggregated data ### 6. Ge...
github_jupyter
## _*Quantum SVM (variational method)*_ The QSVMKernel notebook here demonstrates a kernel based approach. This notebook shows a variational method. For further information please see: [https://arxiv.org/pdf/1804.11326.pdf](https://arxiv.org/pdf/1804.11326.pdf) **This notebook shows the SVM implementation based on ...
github_jupyter
# Building a blockchain in python Inspired from [Python Tutorial: Build A Blockchain In < 60 Lines of Code](https://medium.com/coinmonks/python-tutorial-build-a-blockchain-713c706f6531) and [Learn Blockchains by Building One](https://hackernoon.com/learn-blockchains-by-building-one-117428612f46). ``` import datetime ...
github_jupyter
``` import xai import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sn from sklearn import preprocessing from sklearn.impute import SimpleImputer from sklearn.model_selection import train_test_split from sklearn.metrics import f1_score, confusion_matrix, precision_score, recall_sco...
github_jupyter
<a href="https://colab.research.google.com/github/Eoli-an/Exam-topic-prediction/blob/main/Slides_vs_Transcribes_Frequency.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Plot for Dense Ranks of Word Usage in Slides and Transcribes of Relevant Word...
github_jupyter
## Guest Lecture COMP7230 # Using Python packages for Linked Data & spatial data #### by Dr Nicholas Car This Notebook is the resource used to deliver a guest lecture for the [Australian National University](https://www.anu.edu.au)'s course [COMP7230](https://programsandcourses.anu.edu.au/2020/course/COMP7230): *Intro...
github_jupyter
## Basic Pandas Examples This notebook will walk you through some very basic Pandas concepts. We will start with importing typical data science libraries: ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt ``` ### Series Series is like a list or 1D-array, but with index. All operations are i...
github_jupyter
<a href="https://colab.research.google.com/github/JimKing100/DS-Unit-2-Regression-Classification/blob/master/module4/assignment_regression_classification_4e.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` # Installs %%capture !pip install --upgr...
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
# Introduction to Deep Learning with PyTorch In this notebook, you'll get introduced to [PyTorch](http://pytorch.org/), a framework for building and training neural networks. PyTorch in a lot of ways behaves like the arrays you love from Numpy. These Numpy arrays, after all, are just tensors. PyTorch takes these tenso...
github_jupyter
``` import tensorflow as tf import tensorflow.keras as keras import portpicker import multiprocessing def create_in_process_cluster(num_workers: int, num_ps: int): """ Create and start local servers and return the cluster_resolver. """ worker_ports = [portpicker.pick_unused_port() for _ in range(num_wor...
github_jupyter
**Objective**. This notebook contains illustrating examples for the utilities in the [polyhedron_tools](https://github.com/mforets/polyhedron_tools) module. ``` %display typeset ``` ## 1. Modeling with Polyhedra: back and forth with half-space representation We present examples for creating Polyhedra from matrices ...
github_jupyter
<a href="https://colab.research.google.com/github/R-aryan/Image_Classification_VGG16/blob/master/Classification_Cat_VS_Dogs_Transfer_Learning.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import keras,os from keras.models import Sequential fro...
github_jupyter
``` import matplotlib.pyplot as plt %matplotlib inline ``` ### Построение графика ``` import numpy as np # Независимая (x) и зависимая (y) переменные x = np.linspace(0, 10, 50) y = x # Построение графика plt.title("Линейная зависимость y = x") # заголовок plt.xlabel("x") # ось абсцисс plt.ylabel("y") # ось ординат pl...
github_jupyter
# Interactions This is a collection of interactions, mostly from the book. If you have are reading a print version of the book, or are reading it online via Github or nbviewer you will be unable to run the interactions. So I have created this notebook. Here is how you run an interaction if you do not have IPython ins...
github_jupyter
1 ``` class Rectangle(object): def __init__(self,width,height): self.width=width self.height=height def getArea(self): q=self.height*self.width print("这个矩形的面积为:",q) def getPerimeter(self): w=2*self.height+2*self.width print("这个矩形的周长为:",w) qwe = Rectangle(10,1...
github_jupyter
# Hyperparameter tuning with AI Platform ``` import os import time ``` ## Configure environment *You need to walk through the `local-experimentation.ipynb` notebook to create training and validation datasets.* ``` PROJECT_ID = !(gcloud config get-value core/project) ARTIFACT_STORE = 'gs://{}-artifact-store'.format(P...
github_jupyter
<table align="center"> <td align="center"><a target="_blank" href="http://introtodeeplearning.com"> <img src="https://i.ibb.co/Jr88sn2/mit.png" style="padding-bottom:5px;" /> Visit MIT Deep Learning</a></td> <td align="center"><a target="_blank" href="https://colab.research.google.com/github/aamini/in...
github_jupyter
# Neste notebook vamos simular a interconexão entre SLITs ``` # importar as bibliotecas necessárias import numpy as np # arrays import matplotlib.pyplot as plt # plots plt.rcParams.update({'font.size': 14}) import IPython.display as ipd # to play signals import sounddevice as sd import soundfile as sf # Os próximos mó...
github_jupyter
# Week 2 ## Matlab Resources ### Onramp - Go to: https://matlabacademy.mathworks.com/ and click on the MATLAB Onramp button to start learning MATLAB ### Tutorials #### Get Started with MATLAB and MATLAB Online - [What is MATLAB?](https://youtu.be/WYG2ZZjgp5M)\* - [MATLAB Variables](https://youtu.be/0w9NKt6Fixk)\* - [M...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import xgboost import math from __future__ import division from scipy.stats import pearsonr from sklearn.linear_model import LinearRegression from sklearn import cross_validation, tree, linear_model from sklearn.model_selection import train_test...
github_jupyter
# Process the JRC Excel files ### JRC Data ExpDam is direct expected damage per year from river flooding in Euro (2010 values). Data includes baseline values (average 1976-2005) and impact at SWLs. All figures are multi-model averages based on EC-EARTH r1 to r7 (7 models) PopAff is population affected per year from...
github_jupyter
<img src="https://s3.amazonaws.com/edu-static.mongodb.com/lessons/M220/notebook_assets/screen_align.png" style="margin: 0 auto;"> <h1 style="text-align: center; font-size=58px;">Change Streams</h1> In this lesson, we're going to use change streams to track real-time changes to the data that our application's using. ...
github_jupyter
``` import pandas as pd import numpy as np import pyflux as pf import matplotlib.pyplot as plt from fbprophet import Prophet %matplotlib inline plt.rcParams['figure.figsize']=(20,10) plt.style.use('ggplot') ``` ### Load the data For this work, we're going to use the same retail sales data that we've used before....
github_jupyter
``` import urllib.request import json import pandas as pd from datetime import datetime import seaborn as sns cm = sns.light_palette("red", as_cmap=True) #https://www.trilhaseaventuras.com.br/siglas-dos-principais-aeroportos-do-mundo-iata/ #urlOneWay #https://www.decolar.com/shop/flights-busquets/api/v1/web/search?adu...
github_jupyter
``` import pandas as pd pd.set_option('display.max_columns', None) import numpy as np import matplotlib.pyplot as plt import seaborn as sns plt.style.use('seaborn') #from pandas_profiling import ProfileReportofileReport import warnings warnings.filterwarnings('ignore') from fairlearn.metrics import MetricFrame from f...
github_jupyter
Copyright 2020 The Google Research Authors. 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 writing, so...
github_jupyter
``` from skimage.measure import block_reduce from framework.dependency import * from framework.utli import * def pipeline(X, Qstep=16, Q_mode=1, ML_inv=True, write=False, name='tmp.txt', tPCA=None, isDCT=True): H, W = X.shape[0], X.shape[1] X = X.reshape(1, H, W, -1) X_p, X_q, X_r = X[:,:,:,0:1], block_re...
github_jupyter
``` # from numba import jit # from tqdm import trange # import pandas as pd # eo_df = pd.read_csv("/mnt/sda1/cvpr21/Classification/Aerial-View-Object-Classification/data/train_EO.csv") # eo_df = eo_df.sort_values(by='img_name') # sar_df = pd.read_csv("/mnt/sda1/cvpr21/Classification/Aerial-View-Object-Classification/d...
github_jupyter
<font size="+5">#04. Why Neural Networks Deeply Learn a Mathematical Formula?</font> - Book + Private Lessons [Here ↗](https://sotastica.com/reservar) - Subscribe to my [Blog ↗](https://blog.pythonassembly.com/) - Let's keep in touch on [LinkedIn ↗](www.linkedin.com/in/jsulopz) 😄 # Machine Learning, what does it mea...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Particionando-bases-de-treino-e-teste-com-split-70-30%" data-toc-modified-id="Particionando-bases-de-treino-e-teste-com-split-70-30%-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Particionando bases de ...
github_jupyter
# Example notebook This example will contain the following examples - Creating and saving a graph - Plotting the graph - Executing a node - Loading a graph from disk ``` %matplotlib inline import matplotlib.pyplot as plt import networkx as nx from importlib import reload import os import autodepgraph as adg from a...
github_jupyter
# Dimensionality Reduction Reducing number of dimensions whcih means that the number of new features is lower than the number of original features. First, we need to import numpy, matplotlib, and scikit-learn and get the UCI ML digit image data. Scikit-learn already comes with this data (or will automatically downl...
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
# Probability Notationally, we write $P(E)$ to mean "The probability of event $E$" ## Dependence and Independence Mathematically, we say that two events E and F are independent if the probability that they both happen is the product of the probabilities that each one happens: $P(E,F) = P(E)P(F)$ ## Conditional Pro...
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
<div style="width:100%; background-color: #D9EDF7; border: 1px solid #CFCFCF; text-align: left; padding: 10px;"> <b>Time series: Processing Notebook</b> <ul> <li><a href="main.ipynb">Main Notebook</a></li> <li>Processing Notebook</li> </ul> <br>This Notebook is part of the <a hre...
github_jupyter
``` import gym import torch from torch import nn import torch.nn.functional as F from torch.autograd import Variable from torch.distributions import Bernoulli import matplotlib.pyplot as plt class PolicyNet(nn.Module): def __init__(self, input_dim, output_dim): super(PolicyNet, self).__init__() s...
github_jupyter
## Forecasting, updating datasets, and the "news" In this notebook, we describe how to use Statsmodels to compute the impacts of updated or revised datasets on out-of-sample forecasts or in-sample estimates of missing data. We follow the approach of the "Nowcasting" literature (see references at the end), by using a s...
github_jupyter
# Investigate a Dataset: Titanic Data ## Table of Contents 1. [Introduction](#1-Introduction) 2. [Data Wrangling](#2-Data-Wrangling) 2.1 [Handling Data Types](#2.1-Handling-Data-Types) 2.2 [Handling Missing Values](#2.2-Handling-Missing-Values) &nbsp;&nbsp;&nbsp;&nbsp;2.2.1[Age](#2.2.1-Age) ...
github_jupyter
``` import torch import torch.nn as nn import torch.nn.functional as F from torchvision import datasets, transforms from torch.autograd import Variable from collections import OrderedDict import numpy as np import matplotlib.pyplot as plt plt.rcParams['image.cmap'] = 'gray' %matplotlib inline # input batch size for tra...
github_jupyter
``` %matplotlib inline import pandas as pd import numpy as np from sklearn.linear_model import Ridge from sklearn.preprocessing import LabelEncoder, StandardScaler from sklearn.model_selection import KFold from sklearn.ensemble import RandomForestRegressor import matplotlib.pyplot as plt from sklearn.metrics import ex...
github_jupyter
# Case 1 - Santander - Tunning Hiper-Parametros do Modelo Original ## Marcio de Lima <img style="float: left;" src="https://guardian.ng/wp-content/uploads/2016/08/Heart-diseases.jpg" width="350px"/> ``` import warnings warnings.filterwarnings('ignore') #%pip install -U scikit-learn import numpy as np import pandas as...
github_jupyter
``` # %load IBSI_benchmark_evaluator.py import pandas as pd import argparse def main(args): try: pipeline_df = pd.read_csv(args.pipeline_csv_file) benchmark_df = pd.read_csv(args.benchmark_csv_file) mapping_df = pd.read_csv(args.mapping_csv_file) except: print("Error in readin...
github_jupyter
# Image Classification using GoogLeNet Architecture from Scratch #### In this notebook we are trying to make Object Classification using CNN like [GoogleNet](https://arxiv.org/pdf/1409.4842.pdf). - We have used **GOOGLE CLOUD Platform** to test and train our model - We have also used image augmentation to boost the pe...
github_jupyter
## 1. Obtain and review raw data <p>One day, my old running friend and I were chatting about our running styles, training habits, and achievements, when I suddenly realized that I could take an in-depth analytical look at my training. I have been using a popular GPS fitness tracker called <a href="https://runkeeper.com...
github_jupyter
One of the simplest clustering methods is k-means, in which the number of clusters is chosen in advance, after shich the goal is to partition the inputs into sets S1, ... Sk in a way that minimizes the total sum of squared distances from each point to the mean of its assigned cluster. We will set for an iterative alg...
github_jupyter
``` # Dependencies and Setup import matplotlib.pyplot as plt import pandas as pd import numpy as np import requests import time import json import scipy.stats as st from scipy.stats import linregress # Import API key from api_keys import g_key from citipy import citipy # https://pypi.org/project/citipy/ (pip install ci...
github_jupyter
## Next Task: compute precision and recall threshold 25: zoomy, sustain->thick, smooth (user results) zoomy, sustain -> dark, smooth (word2word matcher resuts) smooth tp dark fp thik tn (fn?) precision = tp/(tp+fp) recall = tp/(tp+fn) for one word, cant compute recall later: tensorfl...
github_jupyter
## Questões: 1. Qual plataforma possui mais títulos incluídos ao catálogo ? 2. Após a visualização do número de títulos em cada plataforma, desejo saber quantos filmes e séries presentes na Netflix estão também vinculados à outras plataformas de streaming, e assim por diante. 3. Rankear pela nota do IMDb, retirando os ...
github_jupyter
``` import keras import tensorflow as tf import librosa import numpy as np import pandas import pickle import os from os import listdir from os.path import isfile, join import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import h5py import math import random import re import csv from sklearn.manifol...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from solve import solve_dual_entropic ### INITIALIZE TEST # set seed np.random.seed(0) # set dimension n_source = 30 n_target = 30 # set target measure #a = np.ones(n_source) #a = a/a.sum() a = 1.5 + np.sin([1*(k / n_source) * 15 for k in range(n_source)]) a = ...
github_jupyter
# The ISB-CGC open-access TCGA tables in Big-Query The goal of this notebook is to introduce you to a new publicly-available, open-access dataset in BigQuery. This set of BigQuery tables was produced by the [ISB-CGC](http://www.isb-cgc.org) project, based on the open-access [TCGA](http://cancergenome.nih.gov/) data a...
github_jupyter
``` # %%writefile train.py # Import Packages import pandas as pd import numpy as np from sklearn.preprocessing import LabelEncoder import xgboost as xgb from pre_ml_process import pre_ml_process import pickle from plot_confusion_matrix import plot_confusion_matrix from sklearn.metrics import confusion_matrix, average_p...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import statsmodels.api as sm import patsy # Data: https://archive.ics.uci.edu/ml/datasets/Bike+Sharing+Dataset # UCI citation: # Dua, D. and Graff, C. (2019). UCI Machine Learning Repository [http://archive.ics.uci.edu/ml]...
github_jupyter
<h1 align="center">SimpleITK Spatial Transformations</h1> **Summary:** 1. Points are represented by vector-like data types: Tuple, Numpy array, List. 2. Matrices are represented by vector-like data types in row major order. 3. Default transformation initialization as the identity transform. 4. Angles specified in ra...
github_jupyter