code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
<a href="https://colab.research.google.com/github/hf2000510/infectious_disease_modelling/blob/master/part_two.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Make sure to open in Colab to see the plots!
### Importing the libraries
```
from scipy.i... | github_jupyter |
```
import pandas as pd
import numpy as np
##bring in Leung data (data is from Leung's Git Repo on betting on nhl 2018); he scraped it from nhl.com
pathjj = '/Users/joejohns/'
data_path = 'data_bootcamp/GitHub/final_project_nhl_prediction/Data/Leung_Data_Results/nhl_data_Leung.csv'
results_path = 'data_bootcamp/Git... | github_jupyter |
```
SAMPLE_TEXT = """
1163751742
1381373672
2136511328
3694931569
7463417111
1319128137
1359912421
3125421639
1293138521
2311944581
"""
SAMPLE_TEXT_2 = """
11637517422274862853338597396444961841755517295286
13813736722492484783351359589446246169155735727126
21365113283247622439435873354154698446526571955763
3694931569... | github_jupyter |
```
import os
from astropy.time import Time
import astropy.coordinates as coord
import astropy.units as u
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
from tqdm.notebook import tqdm
from twobody import TwoBodyKeplerElements, KeplerOrbit
from twobody import (eccentric... | github_jupyter |
# Exemplo 1
## Problema
Considere um arquivo de entrada no formato CSV (comma separated values) com informações relativas a acidentes na aviação civil brasileira nos últimos 10 anos (arquivo anv.csv)
As informações estão separadas pelo caracter separador ~ e entre “” (aspas) conforme o exemplo abaixo:
```ja... | github_jupyter |
##### Copyright 2018 The TensorFlow Authors. [Licensed under the Apache License, Version 2.0](#scrollTo=ByZjmtFgB_Y5).
```
// #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file ... | github_jupyter |
<a href="https://colab.research.google.com/github/darjuangeloys/LinearAlgebra2021/blob/main/Assignment2_DarJuan.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# **Welcome to Python Fundamentals!**
))
N_training = 150
N_validate = 15
batch_size = 4
train_ids = np.arange(N_training)
print(train_ids)
train_gene... | github_jupyter |
# Expression Quality Control (Part 2)
This is a template notebook for performing the final quality control on your organism's expression data. This requires a curated metadata sheet.
## Setup
```
import itertools
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from os i... | github_jupyter |
# Hyperparams And Distributions
This page introduces the hyperparams, and distributions in Neuraxle. You can find [Hyperparams Distribution API here](https://www.neuraxle.org/stable/api/neuraxle.hyperparams.distributions.html), and
[Hyperparameter Samples API here](https://www.neuraxle.org/stable/api/neuraxle.hyperpa... | github_jupyter |
# Hyperparameter Tuning using SageMaker Tensorflow Container
This tutorial focuses on how to create a convolutional neural network model to train the [MNIST dataset](http://yann.lecun.com/exdb/mnist/) using **SageMaker TensorFlow container**. It leverages hyperparameter tuning to kick off multiple training jobs with d... | 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 |
## データの構造をざっと見てみる
```
import os
HOUSING_PATH = os.path.join('/src/datasets', 'housing')
import pandas as pd
def load_housing_data(housing_path=HOUSING_PATH):
csv_path = os.path.join(housing_path, 'housing.csv')
return pd.read_csv(csv_path)
housing = load_housing_data() # csvファイルを読み込む
housing.head() # headで最初... | github_jupyter |
```
import numpy as np
import os
import sys
import xarray as xr
import scipy.io as sio
import matplotlib.pyplot as plt
import datetime
from dotenv import load_dotenv, find_dotenv
# find .env automagically by walking up directories until it's found
dotenv_path = find_dotenv()
load_dotenv(dotenv_path)
src_dir = os.env... | github_jupyter |
```
import matplotlib
matplotlib.use('Agg')
%matplotlib qt
import matplotlib.pyplot as plt
import numpy as np
import os
import SimpleITK as sitk
from os.path import expanduser, join
from scipy.spatial.distance import euclidean
os.chdir(join(expanduser('~'), 'Medical Imaging'))
import liversegmentation
```
---
# Read ... | github_jupyter |
# Plotting Lexical Dispersion - working with JSON reviews
```
import os
import pandas as pd
import json
```
## Data Munging
```
path = './data/690_webhose-2017-03_20170904112233'
good_review_folder = os.listdir(path)
good_reviews = []
for file in good_review_folder:
with open(path + '/' +file, 'r') as json_file:... | github_jupyter |
```
import keras
from keras.models import Sequential, Model, load_model
from keras.layers import Dense, Dropout, Activation, Flatten, Input, Lambda
from keras.layers import Conv2D, MaxPooling2D, AveragePooling2D, Conv1D, MaxPooling1D, LSTM, ConvLSTM2D, GRU, CuDNNLSTM, CuDNNGRU, BatchNormalization, LocallyConnected2D, ... | github_jupyter |
```
import os
import json
import pickle
import random
from collections import defaultdict, Counter
from indra.literature.adeft_tools import universal_extract_text
from indra.databases.hgnc_client import get_hgnc_name, get_hgnc_id
from adeft.discover import AdeftMiner
from adeft.gui import ground_with_gui
from adeft.m... | github_jupyter |
# Import the Fashion MNIST dataset
This guide uses the Fashion MNIST dataset, which contains 70,000 grayscale images in 10 categories. The images show individual articles of clothing at low resolution (28 × 28 pixels), as seen here:
Fashion MNIST sprite
Figure 1. Fashion-MNIST samples (by Zalando, MIT License).
<tab... | github_jupyter |
# Project 3: Implement SLAM
---
## Project Overview
In this project, you'll implement SLAM for robot that moves and senses in a 2 dimensional, grid world!
SLAM gives us a way to both localize a robot and build up a map of its environment as a robot moves and senses in real-time. This is an active area of research... | github_jupyter |
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.

print("Python: ", sys.version)
print("Numpy: ", np.__version__)
print("MXNet: ", mx.__version__)
!cat /proc/cpuinfo | grep processor | wc... | github_jupyter |
```
import pandas as pd
import numpy as np
import os
import json
import altair as alt
import numpy as np
import glob
DATA_DIR = "/Users/user/Documents/GeneInvestigator/results/BDNF/Recombinants"
RELAX_FILES = glob.glob(os.path.join(DATA_DIR, "*.RELAX.json"))
pvalue_threshold = 0.05
RELAX_FILES
def getRELAX_TR(JSON):
... | github_jupyter |
# Residual Networks (ResNet)
:label:`sec_resnet`
As we design increasingly deeper networks it becomes imperative to understand how adding layers can increase the complexity and expressiveness of the network.
Even more important is the ability to design networks where adding layers makes networks strictly more expressi... | github_jupyter |
Perusprosessissa Data Wrangling
<br>
https://en.wikipedia.org/wiki/Data_wrangling
<br>
eli datan valmistelu (ETL putsaus jne) vie yleensä 80% työajasta. Datan valmistelu koneoppimisen malleja varten:
<br>
https://nbviewer.jupyter.org/github/taanila/tilastoapu/blob/master/datan_valmistelu.ipynb
<br>
Luokittele sen jälk... | github_jupyter |
# Breast Cancer Diagnosis
In this notebook we will apply the LogitBoost algorithm to a toy dataset to classify cases of breast cancer as benign or malignant.
## Imports
```
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style='darkgrid', palette='colorblind', color_codes=True)
from... | github_jupyter |
Title: Are the Warriors better without Kevin Durant?
Date: 2019-06-10 12:00
Tags: python
Slug: ab_kd
In the media, there have been debates about whether or not the Golden State Warriors (GSW) are better without Kevin Durant (KD). From the eye-test, it's laughable to even suggest this, as he's one of the top 3 players... | github_jupyter |
it is a playground notebook for related data, such as track length, waypoint distance, car size
```
import math
7*15
100/105
1/105 *10
100/300
1/2
from race_utils import SampleGenerator
generator = SampleGenerator()
testing_param = generator.random_sample()
waypoints = testing_param['waypoints']
len(waypoints)
testing... | github_jupyter |
```
import requests
import arrow
import pprint
import json
from urllib.parse import urlencode
from functools import reduce
token = open("./NOTION_TOKEN", "r").readlines()[0]
notion_version = "2021-08-16"
extra_data = {"filter": {"and": [{"property": "标签",
"multi_select": {"is_not_empt... | github_jupyter |

<div class = 'alert alert-block alert-info'
style = 'background-color:#4c1c84;
color:#eeebf1;
border-width:5px;
... | github_jupyter |
```
def create_simple_convnet_model(*, input_size, output_size, verbose=False, **kwargs):
# Convolutional Network, ........................
model = keras.Sequential()
#.. 1st cnn, layer
model.add(keras.layers.Conv2D(
filters=kwargs['Conv2D_1__filters'],
kerne... | github_jupyter |
# Visualizations in Data
Data visualization is the presentation of data in graphical format. Data visualization is both an art and a science as it combines creating visualizations that are both engaging and accurate. In matheimatical applications visualizations can help you better observe trends and patterns in data, ... | github_jupyter |
# Регрессия - последняя подготовка перед боем!
> 🚀 В этой практике нам понадобятся: `numpy==1.21.2, pandas==1.3.3, matplotlib==3.4.3, scikit-learn==0.24.2, seaborn==0.11.2`
> 🚀 Установить вы их можете с помощью команды: `!pip install numpy==1.21.2, pandas==1.3.3, matplotlib==3.4.3, scikit-learn==0.24.2, seaborn==0... | github_jupyter |
# Hypothesis Testing
From lecture, we know that hypothesis testing is a critical tool in determing what the value of a parameter could be.
We know that the basis of our testing has two attributes:
**Null Hypothesis: $H_0$**
**Alternative Hypothesis: $H_a$**
The tests we have discussed in lecture are:
* One Popula... | github_jupyter |
### University of Washington: Machine Learning and Statistics
# Lecture 6: Density Estimation 1
Andrew Connolly and Stephen Portillo
##### Resources for this notebook include:
- [Textbook](https://press.princeton.edu/books/hardcover/9780691198309/statistics-data-mining-and-machine-learning-in-astronomy) Chapter 8.... | github_jupyter |
### How does Python import Modules?
When we run a statement such as
`import fractions`
what is Python actually doing?
The first thing to note is that Python is doing the import at **run time**, i.e. while your code is actually running.
This is different from traditional compiled languages such as C where modules ... | github_jupyter |
# Self-Driving Car Engineer Nanodegree
## Deep Learning
## Project: Build a Traffic Sign Recognition Classifier
In this notebook, a template is provided for you to implement your functionality in stages, which is required to successfully complete this project. If additional code is required that cannot be included i... | github_jupyter |
```
from systemtools.hayj import *
from systemtools.basics import *
from systemtools.file import *
from systemtools.printer import *
from systemtools.logger import *
from annotator.annot import *
from datatools.jsonutils import *
from nlptools.tokenizer import *
from datatools.htmltools import *
from newssource.goodart... | github_jupyter |
ERROR: type should be string, got "https://github.com/kikocorreoso/brythonmagic\n\nhttp://nbviewer.ipython.org/github/kikocorreoso/brythonmagic/blob/master/notebooks/Brython%20usage%20in%20the%20IPython%20notebook.ipynb\n\n```\nimport IPython\nIPython.version_info\n%install_ext https://raw.github.com/kikocorreoso/brythonmagic/master/brythonmagic.py\n%load_ext brythonmagic\n%%HTML\n<script type=\"text/javascript\" src=\"https://brython.info/src/brython_dist.js\"></script>\n%%brython -c my_container\n# 假如要列出所產生的 html 則使用 -p\nfrom browser import doc, html\n\n# This will be printed in the js console of your browser\nprint('Hello world!')\n\n# This will be printed in the container div on the output below\ndoc[\"my_container\"] <= html.P(\"文字位於 div 標註內\", \n style = {\"backgroundColor\": \"cyan\"})\n%%brython\nfrom browser import alert\n\nalert('Hello world!, Welcome to the brythonmagic!')\n%%brython -c simple_example\nfrom browser import doc, html\n\nfor i in range(10):\n doc[\"simple_example\"] <= html.P(i)\n%%brython -c table\nfrom browser import doc, html\n\ntable = html.TABLE()\n\nfor i in range(10):\n color = ['cyan','#dddddd'] * 5\n table <= html.TR(\n html.TD(str(i+1) + ' x 2 =', style = {'backgroundColor':color[i]}) + \n html.TD((i+1)*2, style = {'backgroundColor':color[i]}))\ndoc['table'] <= table\n%%brython -c canvas_example\nfrom browser.timer import request_animation_frame as raf\nfrom browser.timer import cancel_animation_frame as caf\nfrom browser import doc, html\nfrom time import time\nimport math\n\n# First we create a table to insert the elements\ntable = html.TABLE(cellpadding = 10)\nbtn_anim = html.BUTTON('Animate', Id=\"btn-anim\", type=\"button\")\nbtn_stop = html.BUTTON('Stop', Id=\"btn-stop\", type=\"button\")\ncnvs = html.CANVAS(Id=\"raf-canvas\", width=256, height=256)\n\ntable <= html.TR(html.TD(btn_anim + btn_stop) +\n html.TD(cnvs))\n\ndoc['canvas_example'] <= table\n# Now we access the canvas context\nctx = doc['raf-canvas'].getContext( '2d' ) \n\n# And we create several functions in charge to animate and stop the draw animation\ntoggle = True\n\ndef draw():\n t = time() * 3\n x = math.sin(t) * 96 + 128\n y = math.cos(t * 0.9) * 96 + 128\n global toggle\n if toggle:\n toggle = False\n else:\n toggle = True\n ctx.fillStyle = 'rgb(200,200,20)' if toggle else 'rgb(20,20,200)'\n ctx.beginPath()\n ctx.arc( x, y, 6, 0, math.pi * 2, True)\n ctx.closePath()\n ctx.fill()\n\ndef animate(i):\n global id\n id = raf(animate)\n draw()\n\ndef stop(i):\n global id\n print(id)\n caf(id)\n\ndoc[\"btn-anim\"].bind(\"click\", animate)\ndoc[\"btn-stop\"].bind(\"click\", stop)\n%%HTML\n<script type=\"text/javascript\" src=\"https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.js\"></script>\n%%brython -c simple_d3\nfrom browser import window, document, html\nfrom javascript import JSObject\n\nd3 = window.d3\n\ncontainer = JSObject(d3.select(\"#simple_d3\"))\nsvg = container.append(\"svg\").attr(\"width\", 100).attr(\"height\", 100)\ncircle1 = svg.append(\"circle\").style(\"stroke\", \"gray\").style(\"fill\", \"gray\").attr(\"r\", 40)\ncircle1.attr(\"cx\", 50).attr(\"cy\", 50).attr(\"id\", \"mycircle\")\n\ncircle2 = svg.append(\"circle\").style(\"stroke\", \"gray\").style(\"fill\", \"white\").attr(\"r\", 20)\ncircle2.attr(\"cx\", 50).attr(\"cy\", 50)\n\ndef over(ev):\n document[\"mycircle\"].style.fill = \"blue\"\n\ndef out(ev):\n document[\"mycircle\"].style.fill = \"gray\"\n\ndocument[\"mycircle\"].bind(\"mouseover\", over)\ndocument[\"mycircle\"].bind(\"mouseout\", out)\n%%brython -c manipulating\nfrom browser import document, html\n\ndef hide(ev):\n divs = document.get(selector = 'div.input')\n for div in divs:\n div.style.display = \"none\"\n\ndef show(ev):\n divs = document.get(selector = 'div.input')\n for div in divs:\n div.style.display = \"inherit\"\n\ndocument[\"manipulating\"] <= html.BUTTON('Hide code cells', Id=\"btn-hide\")\ndocument[\"btn-hide\"].bind(\"click\", hide)\n\ndocument[\"manipulating\"] <= html.BUTTON('Show code cells', Id=\"btn-show\")\ndocument[\"btn-show\"].bind(\"click\", show)\nfrom random import randint\n\nn = 100\nx = [randint(0,800) for i in range(n)]\ny = [randint(0,600) for i in range(n)]\nr = [randint(25,50) for i in range(n)]\nred = [randint(0,255) for i in range(n)]\ngreen = [randint(0,255) for i in range(n)]\nblue = [randint(0,255) for i in range(n)]\n%%brython -c other_d3 -i x y r red green blue\nfrom browser import window, document, html\n\nd3 = window.d3\n\nWIDTH = 800\nHEIGHT = 600\n\ncontainer = d3.select(\"#other_d3\")\nsvg = container.append(\"svg\").attr(\"width\", WIDTH).attr(\"height\", HEIGHT)\n\nclass AddShapes:\n def __init__(self, x, y, r, red, green, blue, shape = \"circle\", interactive = True):\n self.shape = shape\n self.interactive = interactive\n self._color = \"gray\"\n self.add(x, y, r, red, green, blue)\n\n def over(self, ev):\n self._color = ev.target.style.fill\n document[ev.target.id].style.fill = \"white\"\n \n def out(self, ev):\n document[ev.target.id].style.fill = self._color\n \n def add(self, x, y, r, red, green, blue):\n for i in range(len(x)):\n self.idx = self.shape + '_' + str(i) \n self._color = \"rgb(%s,%s,%s)\" % (red[i], green[i], blue[i])\n shaped = svg.append(self.shape).style(\"stroke\", \"gray\").style(\"fill\", self._color).attr(\"r\", r[i])\n shaped.attr(\"cx\", x[i]).attr(\"cy\", y[i]).attr(\"id\", self.idx)\n if self.interactive:\n document[self.idx].bind(\"mouseover\", self.over)\n document[self.idx].bind(\"mouseout\", self.out)\n\nplot = AddShapes(x, y, r, red, green, blue, interactive = True)\n%%HTML\n<script type=\"text/javascript\" src=\"https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/OpenLayers.js\"></script>\n%%brython -c ol_map\n# we need to get map png in SSL\n# take a look at http://gis.stackexchange.com/questions/83953/openlayer-maps-issue-with-ssl\nfrom browser import document, window\nfrom javascript import JSConstructor, JSObject\n\n## Div layout\ndocument['ol_map'].style.width = \"800px\"\ndocument['ol_map'].style.height = \"400px\"\ndocument['ol_map'].style.border = \"1px solid black\"\n\nOpenLayers = window.OpenLayers\n\n## Map\n_map = JSConstructor(OpenLayers.Map)('ol_map')\n\n## Addition of a OpenStreetMap layer\n_layer = JSConstructor(OpenLayers.Layer.OSM)( 'Simple OSM map')\n_map.addLayer(_layer)\n\n## Map centered on Lon, Lat = (-3.671416, 40.435897) and a zoom = 14\n## with a projection = \"EPSG:4326\" (Lat-Lon WGS84)\n_proj = JSConstructor(OpenLayers.Projection)(\"EPSG:4326\")\n_center = JSConstructor(OpenLayers.LonLat)(-3.671416, 40.435897)\n_center.transform(_proj, _map.getProjectionObject())\n_map.setCenter(_center, 10)\n\n## Addition of some points around the defined location\nlons = [-3.670, -3.671, -3.672, -3.672, -3.672,\n -3.671, -3.670, -3.670]\nlats = [40.435, 40.435, 40.435, 40.436, 40.437,\n 40.437, 40.437, 40.436]\n\nsite_points = []\nsite_style = {}\n\npoints_layer = JSConstructor(OpenLayers.Layer.Vector)(\"Point Layer\")\n_map.addLayer(points_layer)\n\nfor lon, lat in zip(lons, lats):\n point = JSConstructor(OpenLayers.Geometry.Point)(lon, lat)\n point.transform(_proj, _map.getProjectionObject())\n _feat = JSConstructor(OpenLayers.Feature.Vector)(point)\n points_layer.addFeatures(_feat)\n%%brython -s styling\nfrom browser import doc, html\n\n# Changing the background color\nbody = doc[html.BODY][0]\nbody.style = {\"backgroundColor\": \"#99EEFF\"}\n \n# Changing the color of the imput prompt\ninps = body.get(selector = \".input_prompt\")\nfor inp in inps:\n inp.style = {\"color\": \"blue\"}\n \n# Changin the color of the output cells\nouts = body.get(selector = \".output_wrapper\")\nfor out in outs:\n out.style = {\"backgroundColor\": \"#E0E0E0\"}\n \n# Changing the font of the text cells\ntext_cells = body.get(selector = \".text_cell\")\nfor cell in text_cells:\n cell.style = {\"fontFamily\": \"\"\"\"Courier New\", Courier, monospace\"\"\",\n \"fontSize\": \"20px\"}\n \n# Changing the color of the code cells.\ncode_cells = body.get(selector = \".CodeMirror\")\nfor cell in code_cells:\n cell.style = {\"backgroundColor\": \"#D0D0D0\"}\n```\n\n" | github_jupyter |
```
%pylab inline
import numpy as np
import matplotlib.pyplot as plt
# PyTorch imports
import torch
# This has neural network layer primitives that you can use to build things quickly
import torch.nn as nn
# This has things like activation functions and other useful nonlinearities
from torch.nn import functional as ... | github_jupyter |
## Include the script for your app below. Be sure to include the instructions!
```
import os
import ee
import geemap
import ipywidgets as widgets
from bqplot import pyplot as plt
from ipyleaflet import WidgetControl
ee.Authenticate()
ee.Initialize()
# Create an interactive map
Map = geemap.Map(center=[40, -100], zoom=... | github_jupyter |
[Index](Index.ipynb) - [Back](Widget Basics.ipynb) - [Next](Output Widget.ipynb)
# Widget List
```
import ipywidgets as widgets
```
## Numeric widgets
There are many widgets distributed with IPython that are designed to display numeric values. Widgets exist for displaying integers and floats, both bounded and unbo... | github_jupyter |
# Advanced Tutorial: Creating Gold Annotation Labels with BRAT
This is a short tutorial on how to use BRAT (Brat Rapid Annotation Tool), an
online environment for collaborative text annotation.
http://brat.nlplab.org/
```
%load_ext autoreload
%autoreload 2
%matplotlib inline
import os
# TO USE A DATABASE OTHER THA... | github_jupyter |
```
import copy
import numpy as np
from dm_control import suite
import matplotlib
import matplotlib.animation as animation
import matplotlib.pyplot as plt
def display_video(frames, framerate=30):
height, width, _ = frames[0].shape
dpi = 70
orig_backend = matplotlib.get_backend()
matplotlib.use('Agg') ... | github_jupyter |
## Observations and Insights
```
# Dependencies and Setup
import matplotlib.pyplot as plt
import pandas as pd
import scipy.stats as st
import numpy as np
from scipy.stats import sem
from scipy.stats import linregress
# Study data files
mouse_metadata_path = "data/Mouse_metadata.csv"
study_results_path = "data/Study_r... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
import matplotlib.pyplot as plt
import numpy as np
import pickle
import os
import os.path
import scipy,scipy.spatial
import matplotlib
matplotlib.rcParams['figure.dpi'] = 100
from data_utilities import *
# from definitions import *
# from run_train_eval_net import run_train_ev... | github_jupyter |
... ***CURRENTLY UNDER DEVELOPMENT*** ...
## Validation of the total water level
inputs required:
* historical wave conditions
* emulator output - synthetic wave conditions of TWL
* emulator output - synthetic wave conditions of TWL with 3 scenarios of SLR
in this notebook:
* Comparison of the extreme di... | github_jupyter |
<small><small><i>
All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/02_Python_Datatypes)**
</i></small></small>
# Python Strings
In this class you will learn to create, format, modify and delete strings in Python. Also, you will be introduced to... | github_jupyter |
# Loading Image Data
So far we've been working with fairly artificial datasets that you wouldn't typically be using in real projects. Instead, you'll likely be dealing with full-sized images like you'd get from smart phone cameras. In this notebook, we'll look at how to load images and use them to train neural network... | github_jupyter |
## Utility function test
This notebook is for test of utility functions
```
# Import dependencies
import numpy as np
import scipy.sparse
from scipy.io import savemat, loadmat
from gurobipy import *
```
#### Online Algorithm
```
def fastLP(A, b, c, K, Method):
m = A.shape[0]
n = A.shape[1]
# It is w... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
import ges
import sempler
import numpy as np
import scipy.stats as st
from ges.scores.gauss_obs_l0_pen import GaussObsL0Pen
from ges.scores.general import GeneralScore
```
## Find Causal Graph and get confidence interval [one trial]
```
d = 20 # of attributes
n = 500 # of datapo... | github_jupyter |
```
import pandas as pd
import numpy as np
visit = pd.read_csv("visitorCount.csv",dtype=str)
a = visit.melt( id_vars=['time'])
# a.to_csv("visitorMelt.csv")
movement = pd.read_csv("movements.csv")
movement = movement.astype('category')
len(movement)
stations = pd.read_csv("stations.csv")
stations['double_count'] = Fals... | github_jupyter |
# **Setting up the Environment**
All the necessary paths for datasets on drive and jdk are passed.
Also all the required libraries are installed and imported along with configuration of spark context for future use.
```
# Mounting the google drive for easy access of the dataset
from google.colab import drive
drive.... | github_jupyter |
# Classifying Fashion-MNIST
Now it's your turn to build and train a neural network. You'll be using the [Fashion-MNIST dataset](https://github.com/zalandoresearch/fashion-mnist), a drop-in replacement for the MNIST dataset. MNIST is actually quite trivial with neural networks where you can easily achieve better than 9... | github_jupyter |
```
# This cell is used to change parameter of the rise slideshow,
# such as the window width/height and enabling a scroll bar
from notebook.services.config import ConfigManager
cm = ConfigManager()
cm.update('livereveal', {
'width': 1000,
'height': 600,
'scroll': True,
})
``... | github_jupyter |
# Introduction #
In this lesson we're going to see how we can build neural networks capable of learning the complex kinds of relationships deep neural nets are famous for.
The key idea here is *modularity*, building up a complex network from simpler functional units. We've seen how a linear unit computes a linear fun... | github_jupyter |
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Load-data" data-toc-modified-id="Load-data-1"><span class="toc-item-num">1 </span>Load data</a></span></li><li><span><a href="#Data-Growth" data-toc-modified-id="Data-Growth-2"><span class="toc-i... | github_jupyter |
# Time series in Pastas
*R.A. Collenteur, University of Graz, 2020*
Time series are at the heart of time series analysis, and therefore need to be considered carefully when dealing with time series models. In this notebook more background information is provided on important characteristics of time series and how thes... | github_jupyter |
<h3><center><span style="font-size: 200%;">bTwin</span><sup>β</sup> Find your Bollywood Twin </center></h3>
bTwin is an acronym for Bollywood Twin. The idea is to let the user find his celebrity twin by using the technique of computer vision using convolution neural networks (CNNs).
The current dataset is a col... | github_jupyter |
# Sentiment Classification & How To "Frame Problems" for a Neural Network
by Andrew Trask
- **Twitter**: @iamtrask
- **Blog**: http://iamtrask.github.io
... | github_jupyter |
# CPE 646 Final Project
## Live Memetic Detection
```
import os
from PIL import Image
import numpy as np
from numpy import *
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.con... | github_jupyter |
```
#import the necessary modules
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import scipy
import sklearn
import itertools
from itertools import cycle
import os.path as op
import timeit
import json
import math
import multiprocessing as m_proc
m_proc.cpu_count()
# Im... | github_jupyter |
```
# Python Libraries
%matplotlib inline
import pickle
import numpy as np
import pandas as pd
import matplotlib
from keras.datasets import cifar10
from keras import backend as K
import os,sys
#import Pillow
# Custom Networks
#from networks.lenet import LeNet
#sys.path.append('./')
from networks.pure_cnn import PureC... | github_jupyter |
# Image level consistency check
```
import numpy as np
import pandas as pd
import os
import os.path
import matplotlib.pyplot as plt
import plotly.express as px
from core import *
from config import image_stats_file, xls_file, figures_dir, latex_dir, image_level_results_file, image_level_threshold
pd.set_option('dis... | github_jupyter |
# Data Cleaning And Feature Engineering
* Data is very dirty so we have to clean our data for analysis.
* Also have many missing values represented by -1(have to fix it is very important).
```
import pandas as pd
data=pd.read_csv('original_data.csv')
data.head()
data.shape
#droping duplicates
data=data.drop_duplicate... | github_jupyter |
# Adult Census Income
Debanjan Chowdhury Data 602
# Frame the problem and look at the big picture
## Abstract and Summary
According to an article in the US News - A World report, they were evaluating how indidividuals did not fill out paper works for a long time and the numbers may have been misled. In the year of ... | github_jupyter |
# Probabilistic Programming
A Probabilistic Programming Language (PPL) is a computer language providing statistical modelling and inference functionalities, in order to reason about random variables, probability distributions and conditioning problems. The most popular PPLs are `Stan`, `PyMC`, `Pyro` and `Edward`.
A ... | github_jupyter |
## Twitter Sentiment Analysis
Determining whether a piece of writing is positive, negative or neutral. It’s also known as opinion mining, deriving the opinion or attitude of a speaker.
conda install -n py36 -c conda-forge tweepy
conda install -n py36 -c conda-forge textblob
```
import re
import tweepy
from tweepy i... | github_jupyter |
# **Model Training**
Importing Basic Libraries and setting input stream for training and testing data
```
import keras
from keras.layers import Input, Dense, Lambda, Flatten
from keras.layers import Dropout
from keras.models import Model
#From Keras.applications.vgg16 import VGG16
from keras.applications.vgg19 import... | github_jupyter |
# Week 3
I hope you're getting the hang of things. Today we're going on with the prinicples of data visualization!
## Overview
Once again, the lecture has three parts:
* First you will watch a video on visualization and solve a couple of exercises.
* After that, we'll be reading about *scientific data visualization... | github_jupyter |
# Numpy
```
import numpy as np
from numpy import *
```
A estrutura de dados base do *numpy* sao os **arrays**
```
import numpy as np
# criando um array unidimensional a partir de uma lista
lst = [1,3,5,7,9,10]
a1d = np.array(lst)
print(a1d)
print(lst)
b1d = np.zeros((8))
print('ald=', b1d)
b1d = np.ones((8))
prin... | github_jupyter |
```
# Add user specific python libraries to path
import sys
sys.path.insert(0, "/home/smehra/local-packages")
print(sys.path)
import geopandas as gpd
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import pyspark.sql.functions as F
import os
os.environ["SPARK_CONF_DIR"] = "/da... | github_jupyter |
```
# Update sklearn to prevent version mismatches
#!pip install sklearn --upgrade
# install joblib. This will be used to save your model.
# Restart your kernel after installing
#!pip install joblib
# Import library
import pandas as pd
```
# Read the CSV and Perform Basic Data Cleaning
```
# Read csv file in
df = p... | github_jupyter |
# Inference and Validation
Now that you have a trained network, you can use it for making predictions. This is typically called **inference**, a term borrowed from statistics. However, neural networks have a tendency to perform *too well* on the training data and aren't able to generalize to data that hasn't been seen... | github_jupyter |
# Analysis and Prediction of Crimes in Chicago
## Overview
The goal of this project is to analyze the Chicago Crimes Dataset, classify the crimes and build a model that predicts the crime for 2017-2020.This project consists of three phases - Analyzing the dataset, Classifying the crimes, Building a prediction model.
... | github_jupyter |
# Chapter 3: Deep Learning Libraries
This chapter discusses the important libraries and frameworks that one needs to get started in artificial intelligence. We'll cover the basic functions of the three most popular deep learning frameworks: Tensorflow, Pytorch, and Keras, and show you how to get up and running in each... | github_jupyter |
<table>
<tr>
<td><img src='SystemLink_icon.png' /></td>
<td ><h1><strong>NI SystemLink Python API</strong></h1></td>
</tr>
</table>
## Test Monitor Service Example
***
The Test Monitor Service API provides functions to create, update, delete and query Test results and Test steps.
***
# Prerequi... | github_jupyter |
<a href="https://colab.research.google.com/github/satyajitghana/PadhAI-Course/blob/master/13_OverfittingAndRegularization.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors... | github_jupyter |
## Define the Convolutional Neural Network
After you've looked at the data you're working with and, in this case, know the shapes of the images and of the keypoints, you are ready to define a convolutional neural network that can *learn* from this data.
In this notebook and in `models.py`, you will:
1. Define a CNN w... | github_jupyter |
# Fairness Indicators on TF-Hub Text Embeddings
In this colab, you will learn how to use [Fairness Indicators](https://github.com/tensorflow/fairness-indicators) to evaluate embeddings from [TF Hub](https://www.tensorflow.org/hub). Fairness Indicators is a suite of tools that facilitates evaluation and visualization o... | github_jupyter |
<div style="text-align: right" align="right"><i>Peter Norvig, 3 Jan 2020</i></div>
# Spelling Bee Puzzle
The [3 Jan. 2020 edition of the 538 Riddler](https://fivethirtyeight.com/features/can-you-solve-the-vexing-vexillology/) concerns the popular NYTimes [Spelling Bee](https://www.nytimes.com/puzzles/spelling-bee) p... | github_jupyter |
# Marginal Gaussianization
* Author: J. Emmanuel Johnson
* Email: jemanjohnson34@gmail.com
In this demonstration, we will show how we can do the marginal Gaussianization on a 2D dataset using the Histogram transformation and Inverse CDF Gaussian distribution.
```
import os, sys
cwd = os.getcwd()
# sys.path.insert(0,... | github_jupyter |
```
!pip install -q --upgrade jax jaxlib
from __future__ import print_function, division
import jax.numpy as np
from jax import grad, jit, vmap
from jax import random
key = random.PRNGKey(0)
```
# The Autodiff Cookbook
*alexbw@, mattjj@*
JAX has a pretty general automatic differentiation system. In this notebook,... | github_jupyter |
# In-Class Coding Lab: Lists
The goals of this lab are to help you understand:
- List indexing and slicing
- List methods such as insert, append, find, delete
- How to iterate over lists with loops
## Python Lists work like Real-Life Lists
In real life, we make lists all the time. To-Do lists. Shopping lists. ... | github_jupyter |
### 1. Conditionals. Study the following code:
<code>
print ("statement A")
if x > 0:
print ("statement B")
elif x < 0:
print( "statement C")
else:
print ("statement D")
print ( "statement E")
</code>
```
ans=input("Which of the statements above (A, B, C, D, E) will be printed if x < 0?\n")
... | github_jupyter |
Importing Libraries
```
import random
```
Defining Variables
```
playing = True
game_session = True
suits = ['Hearts', 'Diamonds', 'Spades', 'Clubs']
ranks = ['Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Jack', 'Queen', 'King', 'Ace']
values = {
'Two':2, 'Three':3, 'Four':4, 'Five':5,... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import sys
sys.path.append('../src')
from ratio_space import ratiospace_division, nCk, origin_vector
from myutils import get_figratio, plot_hist, cumulative_bins
fig, ax = plt.subplots(2, 3, sharex=True, sharey=True, figsize=(9, 9))
N = 3
K = 1... | github_jupyter |
## Udacity SDCND - Term 2: MPC Project ##
### I. The Model
I have used **classroom model**.
i. State
- x: position in x direction
- y: position in y direction
- psi: steering angle
- v: velocity of the car
- cte: cross-track error along the y axis
- epsi: error in the steering angle
ii. Actuators
- delta: ... | github_jupyter |
# Multivariate Resemblance Analysis (MRA) Dataset A
In this notebook the multivariate resemblance analysis of Dataset A is performed for all STDG approaches.
```
#import libraries
import warnings
warnings.filterwarnings("ignore")
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import os
pri... | github_jupyter |
```
from qiskit.tools.jupyter import *
from qiskit import IBMQ
IBMQ.load_account()
#provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main')
provider=IBMQ.get_provider(hub='ibm-q-research', group='uni-maryland-1', project='main')
backend = provider.get_backend('ibmq_armonk')
backend_config = backend.con... | github_jupyter |
```
from __future__ import absolute_import, division, print_function
%matplotlib inline
# %matplotlib nbagg
import tensorflow as tf
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from IPython import display
from data_generator_tensorflow import get_batch, print_valid_characters
import os
impor... | github_jupyter |
# eICU Experiments
```
import tensorflow as tf
import numpy as np
import h5py
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import tensorflow_probability as tfp
import sklearn
from sklearn import metrics
import seaborn as sns
import random
```
Follow Read-me instruction to downl... | github_jupyter |
## Precision-Recall-Curves
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.metrics import plot_precision_recall_curve
f... | github_jupyter |
# TensorFlow Tutorial
Welcome to this week's programming assignment. Until now, you've always used numpy to build neural networks. Now we will step you through a deep learning framework that will allow you to build neural networks more easily. Machine learning frameworks like TensorFlow, PaddlePaddle, Torch, Caffe, Ke... | github_jupyter |
# 1D Variability hypothesis testing for HBEC IFN experiment
```
import scanpy as sc
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
from pybedtools import BedTool
import pickle as pkl
%matplotlib inline
import sys
sys.path.append('/home/ssm-user/... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.