text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# 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
### 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
``` 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
##### 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
# 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
# Lightweight python components Lightweight python components do not require you to build a new container image for every code change. They're intended to use for fast iteration in notebook environment. **Building a lightweight python component** To build a component just define a stand-alone python function and then...
github_jupyter
# Predicting Student Admissions with Neural Networks In this notebook, we predict student admissions to graduate school at UCLA based on three pieces of data: - GRE Scores (Test) - GPA Scores (Grades) - Class rank (1-4) The dataset originally came from here: http://www.ats.ucla.edu/ ## Loading the data To load the da...
github_jupyter
``` import tensorflow as tf from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.preprocessing import image from tensorflow.keras.applications import MobileNetV2 from tensorflow.keras.layers import AveragePooling2D from tensorflow.keras.layers import Dropout from tensorflow.keras.la...
github_jupyter
``` import matplotlib.pyplot as plt from matplotlib import cm, colors, rcParams import numpy as np import bayesmark.constants as cc from bayesmark.path_util import abspath from bayesmark.serialize import XRSerializer from bayesmark.constants import ITER, METHOD, TEST_CASE, OBJECTIVE, VISIBLE_TO_OPT # User settings, m...
github_jupyter
# Elementare Datentypen *Erinnerung:* Beim Deklarieren einer Variable muss man deren Datentyp angeben oder er muss eindeutig erkennbar sein. Die beiden folgenden Anweisungen erzeugen beide eine Variable vom Typ `int`: var a int b := 42 Bisher haben wir nur einen Datentyp benutzt: `int`. Dieser Typ steht für ...
github_jupyter
# Trabalhando com o Jupyter Ferramenta que permite criação de código, visualização de resultados e documentação no mesmo documento (.ipynb) **Modo de comando:** `esc` para ativar, o cursor fica inativo **Modo de edição:** `enter` para ativar, modo de inserção ### Atalhos do teclado (MUITO úteis) Para usar os atalhos...
github_jupyter
<a href="https://colab.research.google.com/github/JoanesMiranda/Machine-learning/blob/master/Autoenconder.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ### Importando as bibliotecas necessárias ``` import numpy as np import matplotlib.pyplot as p...
github_jupyter
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_05_3_keras_l1_l2.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 5: Regularization ...
github_jupyter
# Saving a web page to scrape later For many scraping jobs, it makes sense to first save a copy of the web page (or pages) that you want to scrape and then operate on the local files you've saved. This is a good practice for a couple of reasons: You won't be bombarding your target server with requests every time you f...
github_jupyter
# Task 1: Getting started with Numpy Let's spend a few minutes just learning some of the fundamentals of Numpy. (pronounced as num-pie **not num-pee**) ### what is numpy Numpy is a Python library that support large, multi-dimensional arrays and matrices. Let's look at an example. Suppose we start with a little tab...
github_jupyter
# Intake / Pangeo Catalog: Making It Easier To Consume Earth’s Climate and Weather Data Anderson Banihirwe (abanihi@ucar.edu), Charles Blackmon-Luca (blackmon@ldeo.columbia.edu), Ryan Abernathey (rpa@ldeo.columbia.edu), Joseph Hamman (jhamman@ucar.edu) - NCAR, Boulder, CO, USA - Columbia University, Palisades, NY, US...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np import pyart import scipy radar = pyart.io.read('/home/zsherman/cmac_test_radar.nc') radar.fields.keys() max_lat = 37 min_lat = 36 min_lon = -98.3 max_lon = -97 lal = np.arange(min_lat, max_lat, .2) lol = np.arange(min_lon, max_lon, .2) display = pyart.graph.Radar...
github_jupyter
# Exploring Text Data (2) ## PyConUK talk abstract Data set of abstracts for the PyConUK 2016 talks (retrieved 14th Sept 2016 from https://github.com/PyconUK/2016.pyconuk.org) The data can be found in `../data/pyconuk2016/{keynotes,workshops,talks}/*` There are 101 abstracts ## Load the data Firstly, we load all ...
github_jupyter
# Explicit Feedback Neural Recommender Systems Goals: - Understand recommender data - Build different models architectures using Keras - Retrieve Embeddings and visualize them - Add metadata information as input to the model ``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np import os.path as o...
github_jupyter
Author: Maxime Marin @: mff.marin@gmail.com # Accessing IMOS data case studies: Walk-through and interactive session - Analysis In this notebook, we will provide a receipe for further analysis to be done on the same dataset we selected earlier. In the future, a similar notebook can be tailored to a particular datas...
github_jupyter
``` """The purpose of this tutorial is to introduce you to: (1) how gradient-based optimization of neural networks operates in concrete practice, and (2) how different forms of learning rules lead to more or less efficient learning as a function of the shape of the optimization landscape ...
github_jupyter
## Problem Statement An experimental drug was tested on 2100 individual in a clinical trial. The ages of participants ranged from thirteen to hundred. Half of the participants were under the age of 65 years old, the other half were 65 years or older. Ninety five percent patients that were 65 years or older exper...
github_jupyter
# Riemannian Optimisation with Pymanopt for Inference in MoG models The Mixture of Gaussians (MoG) model assumes that datapoints $\mathbf{x}_i\in\mathbb{R}^d$ follow a distribution described by the following probability density function: $p(\mathbf{x}) = \sum_{m=1}^M \pi_m p_\mathcal{N}(\mathbf{x};\mathbf{\mu}_m,\mat...
github_jupyter
``` import os import csv import platform import pandas as pd import networkx as nx from graph_partitioning import GraphPartitioning, utils run_metrics = True cols = ["WASTE", "CUT RATIO", "EDGES CUT", "TOTAL COMM VOLUME", "Qds", "CONDUCTANCE", "MAXPERM", "NMI", "FSCORE", "FSCORE RELABEL IMPROVEMENT", "LONELINESS"] p...
github_jupyter
``` # Dataset from here # https://archive.ics.uci.edu/ml/datasets/Adult import great_expectations as ge import matplotlib.pyplot as plt import pandas as pd import numpy as np %matplotlib inline """ age: continuous. workclass: Private, Self-emp-not-inc, Self-emp-inc, Federal-gov, Local-gov, State-gov, Without-pay, Never...
github_jupyter
# Nothing But NumPy: A 3-layer Binary Classification Neural Network on Iris Flowers Part of the blog ["Nothing but NumPy: Understanding & Creating Binary Classification Neural Networks with Computational Graphs from Scratch"](https://medium.com/@rafayak/nothing-but-numpy-understanding-creating-binary-classification-ne...
github_jupyter
``` import san from src_end2end import statistical_features import lsa_features import pickle import numpy as np from tqdm import tqdm import pandas as pd import os import skopt from skopt import gp_minimize from sklearn import preprocessing from skopt.space import Real, Integer, Categorical from skopt.utils import use...
github_jupyter
# Programming_Assingment17 ``` Question1. Create a function that takes three arguments a, b, c and returns the sum of the numbers that are evenly divided by c from the range a, b inclusive. Examples evenly_divisible(1, 10, 20) ➞ 0 # No number between 1 and 10 can be evenly divided by 20. evenly_divisible(1, 10, 2) ➞ ...
github_jupyter
# Simulating a Predator and Prey Relationship Without a predator, rabbits will reproduce until they reach the carrying capacity of the land. When coyotes show up, they will eat the rabbits and reproduce until they can't find enough rabbits. We will explore the fluctuations in the two populations over time. # Using Lo...
github_jupyter
# Late contributions Received and Made ## Setup ``` %load_ext sql from django.conf import settings connection_string = 'postgresql+psycopg2://{USER}:{PASSWORD}@{HOST}:{PORT}/{NAME}'.format( **settings.DATABASES['default'] ) %sql $connection_string ``` ## Unique Composite Key The documentation says that the reco...
github_jupyter
## Imports ``` from __future__ import print_function, division import pandas as pd import numpy as np import statsmodels.api as sm import statsmodels.formula.api as smf import patsy import seaborn as sns import matplotlib.pyplot as plt import scipy.stats as stats %matplotlib inline from sklearn.linear_model import L...
github_jupyter
``` from sympy import pi, cos, sin, symbols from sympy.utilities.lambdify import implemented_function import pytest from sympde.calculus import grad, dot from sympde.calculus import laplace from sympde.topology import ScalarFunctionSpace from sympde.topology import element_of from sympde.topology import NormalVector f...
github_jupyter
``` import re ``` The re module uses a backtracking regular expression engine Regular expressions match text patterns Use case examples: - Check if an email or phone number was written correctly. - Split text by some mark (comma, dot, newline) which may be useful to parse data. - Get content from HTML tags. - Impr...
github_jupyter
# A simple DNN model built in Keras. Let's start off with the Python imports that we need. ``` import os, json, math import numpy as np import shutil import tensorflow as tf print(tf.__version__) ``` ## Locating the CSV files We will start with the CSV files that we wrote out in the [first notebook](../01_explore/t...
github_jupyter
``` import numpy as np import torch import pandas as pd import json import seaborn as sns import matplotlib.pyplot as plt from sklearn.preprocessing import LabelEncoder as LE import bisect import torch from datetime import datetime from sklearn.model_selection import train_test_split !cp -r drive/My\ Drive/T11 ./T11 np...
github_jupyter
# Multivariate Dependencies Beyond Shannon Information This is a companion Jupyter notebook to the work *Multivariate Dependencies Beyond Shannon Information* by Ryan G. James and James P. Crutchfield. This worksheet was written by Ryan G. James. It primarily makes use of the ``dit`` package for information theory cal...
github_jupyter
``` %run technical_trading.py #%% data = pd.read_csv('../../data/hs300.csv',index_col = 'date',parse_dates = 'date') data.vol = data.vol.astype(float) #start = pd.Timestamp('2005-09-01') #end = pd.Timestamp('2012-03-15') #data = data[start:end] #%% chaikin = CHAIKINAD(data, m = 14, n = 16) kdj = KDJ(data) adx = ADX(dat...
github_jupyter
``` import numpy as np import torch import torchvision import torch.nn as nn import torch.optim as optim from nn_interpretability.interpretation.lrp.lrp_0 import LRP0 from nn_interpretability.interpretation.lrp.lrp_eps import LRPEpsilon from nn_interpretability.interpretation.lrp.lrp_gamma import LRPGamma from nn_inte...
github_jupyter
# Project 1: Linear Regression Model This is the first project of our data science fundamentals. This project is designed to solidify your understanding of the concepts we have learned in Regression and to test your knowledge on regression modelling. There are four main objectives of this project. 1\. Build Linear Re...
github_jupyter
[SCEC BP3-QD](https://strike.scec.org/cvws/seas/download/SEAS_BP3.pdf) document is here. # [DRAFT] Quasidynamic thrust fault earthquake cycles (plane strain) ## Summary * Most of the code here follows almost exactly from [the previous section on strike-slip/antiplane earthquake cycles](c1qbx/part6_qd). * Since the f...
github_jupyter
# 머신 러닝 교과서 3판 # 9장 - 웹 애플리케이션에 머신 러닝 모델 내장하기 **아래 링크를 통해 이 노트북을 주피터 노트북 뷰어(nbviewer.jupyter.org)로 보거나 구글 코랩(colab.research.google.com)에서 실행할 수 있습니다.** <table class="tfo-notebook-buttons" align="left"> <td> <a target="_blank" href="https://nbviewer.org/github/rickiepark/python-machine-learning-book-3rd-edition...
github_jupyter
``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt df = pd.read_csv('Data/20200403-WHO.csv') df df = df[df['Country/Territory'] != 'conveyance (Diamond'] death_rate = df['Total Deaths']/df['Total Confirmed']*100 df['Death Rate'] = death_rate df countries_infected = len(df)...
github_jupyter
#Gaussian bayes classifier In this assignment we will use a Gaussian bayes classfier to classify our data points. # Import packages ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.stats import multivariate_normal from sklearn.metrics import classification_report from matplotlib ...
github_jupyter
# BLU02 - Learning Notebook - Data wrangling workflows - Part 2 of 3 ``` import matplotlib.pyplot as plt import pandas as pd import os ``` # 2 Combining dataframes in Pandas ## 2.1 How many programs are there per season? How many different programs does the NYP typically present per season? Programs are under `/d...
github_jupyter
``` %matplotlib inline ``` # Faces dataset decompositions This example applies to `olivetti_faces` different unsupervised matrix decomposition (dimension reduction) methods from the module :py:mod:`sklearn.decomposition` (see the documentation chapter `decompositions`) . ``` print(__doc__) # Authors: Vlad Niculae...
github_jupyter
Wayne H Nixalo - 09 Aug 2017 This JNB is an attempt to do the neural artistic style transfer and super-resolution examples done in class, on a GPU using PyTorch for speed. Lesson NB: [neural-style-pytorch](https://github.com/fastai/courses/blob/master/deeplearning2/neural-style-pytorch.ipynb) ## Neural Style Transfe...
github_jupyter
<a href="https://colab.research.google.com/github/gabilodeau/INF6804/blob/master/FeatureVectorsComp.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> INF6804 Vision par ordinateur Polytechnique Montréal Distances entre histogrammes (L1, L2, MDPA, Bh...
github_jupyter
# The IPython widgets, now in IHaskell !! It is highly recommended that users new to jupyter/ipython take the *User Interface Tour* from the toolbar above (Help -> User Interface Tour). > This notebook introduces the [IPython widgets](https://github.com/ipython/ipywidgets), as implemented in [IHaskell](https://github...
github_jupyter
# Contanimate DNS Data ``` """ Make dataset pipeline """ import pandas as pd import numpy as np import os from collections import Counter import math import torch from torch.utils.data import DataLoader from torch.nn.utils.rnn import pad_sequence from dga.models.dga_classifier import DGAClassifier from dga.datasets.do...
github_jupyter
# Visualize the best RFE conformations using cMDS plots ``` import pandas as pd import numpy as np import sys sys.path.append('../..') from helper_modules.run_or_load import * from helper_modules.MDS import * ``` ### Load protein related data ``` prot_name = 'fxa' DIR = '../1_Download_and_prepare_protein_ensembles' ...
github_jupyter
<a href="https://colab.research.google.com/github/kuriousk516/HIST4916a-Stolen_Bronzes/blob/main/Stolen_Bronzes.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Stolen Bronzes: Western Museums and Repatriation ## Introduction >"*Walk into any Eur...
github_jupyter
##### Copyright 2020 The OpenFermion Developers ``` ``` # Introduction to OpenFermion <table class="tfo-notebook-buttons" align="left"> <td> <a target="_blank" href="https://quantumai.google/openfermion/tutorials/intro_to_openfermion"><img src="https://quantumai.google/site-assets/images/buttons/quantumai_logo...
github_jupyter
<img src="img/python-logo-notext.svg" style="display:block;margin:auto;width:10%"/> <h1 style="text-align:center;">Python: Pandas Data Frames 1</h1> <h2 style="text-align:center;">Coding Akademie München GmbH</h2> <br/> <div style="text-align:center;">Dr. Matthias Hölzl</div> <div style="text-align:center;">Allait...
github_jupyter
``` %load_ext autoreload %autoreload 2 import numpy as np import matplotlib.pyplot as plt from libwallerlab.opticsalgorithms.motiondeblur import blurkernel ``` # Overview This notebook explores a SNR vs. acquisition time analysis for strobed illumination, stop and stare, and coded illumination acquisition strategies....
github_jupyter
**Pix-2-Pix Model using TensorFlow and Keras** A port of pix-2-pix model built using TensorFlow's high level `tf.keras` API. Note: GPU is required to make this model train quickly. Otherwise it could take hours. Original : https://www.kaggle.com/vikramtiwari/pix-2-pix-model-using-tensorflow-and-keras/notebook ## In...
github_jupyter
<a href="https://qworld.net" target="_blank" align="left"><img src="../qworld/images/header.jpg" align="left"></a> $ \newcommand{\bra}[1]{\langle #1|} $ $ \newcommand{\ket}[1]{|#1\rangle} $ $ \newcommand{\braket}[2]{\langle #1|#2\rangle} $ $ \newcommand{\dot}[2]{ #1 \cdot #2} $ $ \newcommand{\biginner}[2]{\left\langle...
github_jupyter
<a href="https://colab.research.google.com/github/lucianaribeiro/filmood/blob/master/SentimentDetectionRNN.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` # Installing Tensorflow ! pip install --upgrade tensorflow # Installing Keras ! pip insta...
github_jupyter
``` !pip install torch torchtext !git clone https://github.com/neubig/nn4nlp-code.git from collections import defaultdict import math import time import random import numpy as np import torch import torch.nn as nn import torch.nn.functional as F N=2 #length of window on each side (so N=2 gives a total window size of 5,...
github_jupyter
# Supplemental Information: > **"Clonal heterogeneity influences the fate of new adaptive mutations"** > Ignacio Vázquez-García, Francisco Salinas, Jing Li, Andrej Fischer, Benjamin Barré, Johan Hallin, Anders Bergström, Elisa Alonso-Pérez, Jonas Warringer, Ville Mustonen, Gianni Liti ## Figure 3 (+ Supp. Figs.) Th...
github_jupyter
# The Constellation Wizard requires a STK Scenario to be open Simply run the cell below and the constelation wizard will appear ``` from tkinter import Tk from tkinter.ttk import * from tkinter import W from tkinter import E from tkinter import scrolledtext from tkinter import INSERT from tkinter import END from tkin...
github_jupyter
## Using low dimensional embeddings to discover subtypes of breast cancer This notebook is largely based on https://towardsdatascience.com/reduce-dimensions-for-single-cell-4224778a2d67 (credit to Nikolay Oskolkov). https://www.nature.com/articles/s41467-018-07582-3#data-availability ``` import pandas as pd import n...
github_jupyter
``` import hoomd import hoomd.hpmc import ex_render import math from matplotlib import pyplot import numpy %matplotlib inline ``` # Selecting move sizes HPMC allows you to set the translation and rotation move sizes. Set the move size too small and almost all trial moves are accepted, but it takes many time steps to ...
github_jupyter
## Prediction sine wave function using Gaussian Process An example for Gaussian process algorithm to predict sine wave function. This example is from ["Gaussian Processes regression: basic introductory example"](http://scikit-learn.org/stable/auto_examples/gaussian_process/plot_gp_regression.html). ``` import numpy a...
github_jupyter
# Convolutional Neural Networks --- In this notebook, we train a **CNN** to classify images from the CIFAR-10 database. The images in this database are small color images that fall into one of ten classes; some example images are pictured below. <img src='notebook_ims/cifar_data.png' width=70% height=70% /> ### Test...
github_jupyter
### Convolutional autoencoder Since our inputs are images, it makes sense to use convolutional neural networks (convnets) as encoders and decoders. In practical settings, autoencoders applied to images are always convolutional autoencoders --they simply perform much better. Let's implement one. The encoder will consi...
github_jupyter
``` import sys import os import glob import subprocess as sp import multiprocessing as mp import pandas as pd import numpy as np from basic_tools import * debug=False def run_ldsc(pheno_code,ld,output,mode='original',samp_prev=np.nan,pop_prev=np.nan): if os.path.exists(ldsc_path.format(pheno_code)+'.log'): ...
github_jupyter
# anesthetic plot gallery This functions as both some examples of plots that can be produced, and a tutorial. Any difficulties/issues/requests should be posted as a [GitHub issue](https://github.com/williamjameshandley/anesthetic/issues) ## Download example data Download some example data from github (or alternativ...
github_jupyter
``` %matplotlib inline ``` Sequence-to-Sequence Modeling with nn.Transformer and TorchText =============================================================== This is a tutorial on how to train a sequence-to-sequence model that uses the `nn.Transformer <https://pytorch.org/docs/master/nn.html?highlight=nn%20transformer#...
github_jupyter
--- _You are currently looking at **version 1.0** of this notebook. To download notebooks and datafiles, as well as get help on Jupyter notebooks in the Coursera platform, visit the [Jupyter Notebook FAQ](https://www.coursera.org/learn/python-data-analysis/resources/0dhYG) course resource._ --- # The Series Data Str...
github_jupyter
``` %matplotlib inline ``` This notebook is based on: https://mne.tools/stable/auto_tutorials/stats-sensor-space/75_cluster_ftest_spatiotemporal.html # Spatiotemporal permutation F-test on full sensor data Tests for differential evoked responses in at least one condition using a permutation clustering test. The Fie...
github_jupyter
``` import os import xgboost as xgb import pandas as pd import numpy as np from utils import encode_numeric_zscore_list, encode_numeric_zscore_all, to_xy, encode_text_index_list, encode_numeric_log_all from xgboost.sklearn import XGBClassifier, XGBRegressor from sklearn import datasets from sigopt_sklearn.search import...
github_jupyter
# Plus proches voisins - évaluation Comment évaluer la pertinence d'un modèle des plus proches voisins. ``` %matplotlib inline from papierstat.datasets import load_wines_dataset df = load_wines_dataset() X = df.drop(['quality', 'color'], axis=1) y = df['quality'] from sklearn.neighbors import KNeighborsRegressor knn...
github_jupyter
<center> <font size=5> <h1>Define working environment</h1> </font> </center> The following cells are used to: - Import needed libraries - Set the environment variables for Python, Anaconda, GRASS GIS and R statistical computing - Define the ["GRASSDATA" folder](https://grass.osgeo.org/grass73/manuals/helptext.html),...
github_jupyter
# Introducción a Python: Sintaxis, Funciones y Booleanos <img style="float: right; margin: 0px 0px 15px 15px;" src="https://www.python.org/static/community_logos/python-logo.png" width="200px" height="200px" /> > Bueno, ya que sabemos qué es Python, y que ya tenemos las herramientas para trabajarlo, veremos cómo usar...
github_jupyter
``` import numpy as np import random import pandas as pd import sklearn from matplotlib import pyplot as plt plt.rcParams['figure.figsize'] = (10.0, 8.0) from sklearn.datasets import make_biclusters from sklearn.datasets import samples_generator as sg from sklearn.datasets import fetch_20newsgroups from sklearn.featu...
github_jupyter
## Assigning gender based on first name A straightforward task in natural language processing is to assign gender based on first name. Social scientists are often interested in gender inequalities and may have a dataset that lists name but not gender, such as a list of journal articles with authors in a study of gende...
github_jupyter
version 1.0.3 #![Spark Logo](http://spark-mooc.github.io/web-assets/images/ta_Spark-logo-small.png) + ![Python Logo](http://spark-mooc.github.io/web-assets/images/python-logo-master-v3-TM-flattened_small.png) # **Text Analysis and Entity Resolution** ####Entity resolution is a common, yet difficult problem in data clea...
github_jupyter
# Representación y visualización de datos El aprendizaje automático trata de ajustar modelos a los datos; por esta razón, empezaremos discutiendo como los datos pueden ser representados para ser accesibles por el ordenador. Además de esto, nos basaremos en los ejemplos de matplotlib de la sección anterior para usarlos...
github_jupyter
# Day 1 ``` from sklearn.datasets import load_iris import pandas as pd import numpy as np iris = load_iris() df = pd.DataFrame(np.c_[iris['data'], iris['target']], columns = iris['feature_names'] + ['species']) df['species'] = df['species'].replace([0,1,2], iris.target_names) df.head() import numpy as np import matpl...
github_jupyter
# Table of Contents <p><div class="lev1 toc-item"><a href="#Simulated-annealing-in-Python" data-toc-modified-id="Simulated-annealing-in-Python-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Simulated annealing in Python</a></div><div class="lev2 toc-item"><a href="#References" data-toc-modified-id="References-11"><...
github_jupyter
# Writing a Device driver ### Basic structure Here is a simple (but complete and functional) code block that implements a VISA driver for a power sensor: ``` import labbench as lb import pandas as pd # Specific driver definitions are implemented by subclassing classes like lb.VISADevice class PowerSensor(lb.VISADevic...
github_jupyter
# Computation on Arrays: Broadcasting We saw in the previous section how NumPy's universal functions can be used to *vectorize* operations and thereby remove slow Python loops. Another means of vectorizing operations is to use NumPy's *broadcasting* functionality. Broadcasting is simply a set of rules for applying bin...
github_jupyter
# Hyper parameters The goal here is to demonstrate how to optimise hyper-parameters of various models The kernel is a short version of https://www.kaggle.com/mlisovyi/featureengineering-basic-model ``` max_events = None import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.r...
github_jupyter
``` #hide #default_exp clean from nbdev.showdoc import show_doc #export import io,sys,json,glob,re from fastcore.script import call_parse,Param,bool_arg from fastcore.utils import ifnone from nbdev.imports import Config from nbdev.export import nbglob from pathlib import Path #hide #For tests only from nbdev.imports im...
github_jupyter
# openCV Configure for Raspberry PI What is openCV? * Collection of computer vision tools in one place * Computational photography to object detection Where is openCV? * http://opencv.org/ What resources did I use? * http://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/ * htt...
github_jupyter
<img src="data/photutils_banner.svg"> ## Photutils - Code: https://github.com/astropy/photutils - Documentation: http://photutils.readthedocs.org/en/stable/ - Issue Tracker: https://github.com/astropy/photutils/issues ## Photutils Overview - Background and background noise estimation - Source Detection and Extract...
github_jupyter
# Extracting condtion-specific trials The aim of this section is to extract the trials according to the trigger channel. We will explain how the events can be generated from the stimulus channels and how to extract condition specific trials (epochs). Once the trials are extracted, bad epochs will be identified and exc...
github_jupyter
# cadCAD Tutorials: The Robot and the Marbles, part 3 In parts [1](../robot-marbles-part-1/robot-marbles-part-1.ipynb) and [2](../robot-marbles-part-2/robot-marbles-part-2.ipynb) we introduced the 'language' in which a system must be described in order for it to be interpretable by cadCAD and some of the basic concepts...
github_jupyter
``` %load_ext autoreload %autoreload 2 %matplotlib inline %config InlineBackend.figure_format = 'retina' ``` ## Introduction Because of the relational structure in a graph, we can begin to think about "importance" of a node that is induced because of its relationships to the rest of the nodes in the graph. Before we...
github_jupyter
# Tutorial 08: Creating Custom Environments 创建自定义环境 This tutorial walks you through the process of creating custom environments in Flow. Custom environments contain specific methods that define the problem space of a task, such as the state and action spaces of the RL agent and the signal (or reward) that the RL algor...
github_jupyter
# Introdcution This trial describes how to create edge and screw dislocations in iron BCC strating with one unitcell containing two atoms ## Background The elastic solution for displacement field of dislocations is provided in the paper [Dislocation Displacement Fields in Anisotropic Media](https://doi.org/10.1063/1...
github_jupyter
# Managing pins ``` %load_ext autoreload %autoreload 2 import qiskit_metal as metal from qiskit_metal import designs, draw from qiskit_metal import MetalGUI, Dict, Headings Headings.h1('Welcome to Qiskit Metal') design = designs.DesignPlanar() gui = MetalGUI(design) ``` First we create some transmon pockets to have a...
github_jupyter
# Deep Convolutional Neural Networks In this assignment, we will be using the Keras library to build, train, and evaluate some *relatively simple* Convolutional Neural Networks to demonstrate how adding layers to a network can improve accuracy, yet are more computationally expensive. The purpose of this assignment ...
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
# Various Routines to Harvest CRIM Metadata from Production Server ### Just the basics here, allowing interaction with "request" as a way to retrieve individual Observations and Relationships ``` import requests import pandas as pd ``` # Variables Now we can set a variable, in this case the URL of a single Observati...
github_jupyter
#Sheet Copy Copy tab from a sheet to a sheet. #License 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...
github_jupyter
<a href="https://colab.research.google.com/github/spyrosviz/Injury_Prediction_MidLong_Distance_Runners/blob/main/ML%20models/Models_Runners_Injury_Prediction.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` # Import Libraries import pandas as pd...
github_jupyter
``` import pandas as pd import numpy as np from datetime import datetime import os ``` # Define Which Input Files to Use The default settings will use the input files recently produced in Step 1) using the notebook `get_eia_demand_data.ipynb`. For those interested in reproducing the exact results included in the repos...
github_jupyter