text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` #IMPORT SEMUA LIBARARY #IMPORT LIBRARY PANDAS import pandas as pd #IMPORT LIBRARY UNTUK POSTGRE from sqlalchemy import create_engine import psycopg2 #IMPORT LIBRARY CHART from matplotlib import pyplot as plt from matplotlib import style #IMPORT LIBRARY BASE PATH import os import io #IMPORT LIBARARY PDF from fpdf im...
github_jupyter
``` %load_ext autoreload %autoreload 2 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torchvision import torchvision.transforms as transforms from torchsummaryX import summary import matplotlib.pyplot as plt import time import os from UnarySim.sw.kernel.nn_utils i...
github_jupyter
# Auditory P300 with Muse This experiment is similar to the visual P300 experiment, but used auditory stimuli instead to produce an oddball. Stimuli were presented for 200 ms with an intertrial interval of 400 ms and random jitter of ±100ms. The task was to count the number of times the oddball stimulus is played. S...
github_jupyter
# Introduction to the Indian Buffet Process # DEMO_MATRIX_COMPLETION ``` ## import necessary packages import numpy as np # library to work with numpy arrays and math operations from random import sample import sys import GLFM import csv import matplotlib.pyplot as plt # --------------------------------------------- # ...
github_jupyter
The objective of this notebook is to show how to read and plot the trajectory and the temperature measured by a drifting buoy. ``` %matplotlib inline import netCDF4 import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib import colors from mpl_toolkits.basemap import Basemap ``` # ...
github_jupyter
``` %pylab inline %config InlineBackend.figure_format = 'retina' from SuchTree import SuchTree, SuchLinkedTrees, pearson import pandas as pd import seaborn #T1 = SuchTree( 'data/gopher-louse/gopher.tree' ) #T2 = SuchTree( 'data/gopher-louse/lice.tree' ) #links = pd.DataFrame.from_csv( 'data/gopher-louse/gopher-louse-as...
github_jupyter
``` #!/Tsan/bin/python # -*- coding: utf-8 -*- # Libraries To Use from __future__ import division from CloudQuant import MiniSimulator import numpy as np import pandas as pd import statsmodels.api as sm import scipy.stats import os from sklearn import linear_model from datetime import datetime,time,date import matplo...
github_jupyter
# Swaption Pricing Part 2: American Monte Carlo for Bermudas *Copyright (c) 2015 Matthias Groncki* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notic...
github_jupyter
##### Copyright 2021 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
# Time Series Forecasting with Linear Learner _**Using Linear Regression to Forecast Monthly Demand**_ --- --- ## Contents 1. [Background](#Background) 1. [Setup](#Setup) 1. [Data](#Data) 1. [Train](#Train) 1. [Host](#Host) 1. [Forecast](#Forecast) 1. [Extensions](#Extensions) --- ## Background Forecasting is ...
github_jupyter
``` m = "testing" m[1:5] start=2 take=2 m[start:take+start] m[2:4] state = "mississippi" state[5:9] grades = [ 'A', 'A', 'B+', 'C+', 'A-'] grades[2:3] grades[2:5] grades[2:7] print(grades) grades[3] = 'A-' print(grades) name ="mike" name[0] = "M" numbers = [10, 15, 99, 42, 7] print(numbers[1:4]) for number in numbers: ...
github_jupyter
<h1 align =center>Statistics With Numpy</h1> #### Order statistics |Funcation|Decreption| |----------|----------| |**amin(a[, axis, out, keepdims, initial, where])**|Return the minimum of an array or minimum along an axis.| |**amax(a[, axis, out, keepdims, initial, where])**|Return the maximum of an array or maximum ...
github_jupyter
# CS446/546 Class Session 2 - Adjacency Forests ## Comparing asymptotic running time for testing two vertices for an edge In this exercise, we'll compare the asymptotic computational running time for testing if there is an edge between a pair of vertices, averaged over all pairs of vertices in the graph. We'll do it ...
github_jupyter
``` import dash import dash_core_components as dcc import dash_html_components as html import plotly.graph_objs as go import plotly.figure_factory as FF import plotly.offline as offline from datetime import datetime import glob import os.path import pymysql import sqlconfig # From sqlconfig.py import pandas as pd impor...
github_jupyter
On va maintenant utiliser une image naturelle comme entrée. At each time, the pipeline is the following: * take an image, * turn into blocks corresponding to the edges' centers, * into each block determine the most likely orientation <!-- TEASER_END --> Let's first create a dummy movie: ``` import os import mat...
github_jupyter
# Fit Functions [Fit functions]: ../../api_static/plasmapy.analysis.fit_functions.rst [linregress()]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.linregress.html [curve_fit()]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html [fsolve()]: https://docs.scipy.org/doc...
github_jupyter
``` import os import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import torch from torch.utils.data import Dataset im_dir = '/Volumes/Tatum_SSD-1/Grad_school/m2py/Morphology_labels/OFET_morph_maps/Default_params/' im_files = os.listdir(im_dir) print(len(im_files)) # p...
github_jupyter
##### Copyright 2020 The OpenFermion Developers ``` #@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 ...
github_jupyter
# **DISTIL Installation** ``` !git clone https://github.com/decile-team/distil.git !pip install apricot-select %cd distil/examples/ ``` **Imports** ``` import pandas as pd import numpy as np from torch.utils.data import Dataset from torch.utils.data import DataLoader import torch.nn.functional as F from torch impor...
github_jupyter
# Settings ``` EXP_NO = 30 SEED = 1 N_SPLITS = 5 TARGET = 'target' GROUP = 'art_series_id' REGRESSION = False assert((TARGET, REGRESSION) in (('target', True), ('target', False), ('sorting_date', True))) CV_THRESHOLD = None PAST_EXPERIMENTS = tuple(exp_no for exp_no in range(4, 28 + 1) # 7 は予測...
github_jupyter
### Note Please view the [README](https://github.com/deeplearning4j/deeplearning4j/tree/master/dl4j-examples/tutorials/README.md) to learn about installing, setting up dependencies, and importing notebooks in Zeppelin ### Background In this tutorial we will use a LSTM neural network to predict instacart users' purch...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` #@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.o...
github_jupyter
# Ward This notebook illustrates the hierarchical clustering of graphs by the [Ward method](https://scikit-network.readthedocs.io/en/latest/reference/hierarchy.html), after embedding in a space of low dimension. ``` from IPython.display import SVG import numpy as np from sknetwork.data import karate_club, painters, m...
github_jupyter
``` import matplotlib.pyplot as plt import pandas as pd import numpy as np from sklearn.linear_model import LogisticRegression from sklearn import metrics from sklearn.metrics import classification_report, confusion_matrix, f1_score from sklearn.metrics import make_scorer, f1_score, accuracy_score, recall_score, precis...
github_jupyter
# Crawler [Click here to run this chapter on Colab](https://colab.research.google.com/github/AllenDowney/DSIRP/blob/main/notebooks/crawler.ipynb) ## Crawling the web At this point we have all the pieces we need to build a web crawler; it's time to bring them together. First, from `philosophy.ipynb`, we have `WikiFe...
github_jupyter
``` import pandas as pd import datetime from tqdm import tqdm '''Getting names of all csv files(stocks) in the folder''' import os path = '/home/dhruv/Downloads/f&o iday data' csv_files_initial = [f for f in os.listdir(path) if f.endswith('.CSV')] stocks_initial = [sub[ : -4] for sub in csv_files_initial] for i in ran...
github_jupyter
<img src="../../../images/qiskit-heading.gif" alt="Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook" width="500 px" align="left"> ## _*Entanglement*_ The latest version of this notebook is available on https://github.com/qiskit/qiskit-tutorial. *** ### Contr...
github_jupyter
# Tutorial 4: Angiography Reconstruction ``` #Import required system libraries for file management import sys,importlib,os # Provide path to oct-cbort library module_path=os.path.abspath('/Users/damondepaoli/Documents/GitHub/oct-cbort') if module_path not in sys.path: sys.path.append(module_path) # Import oct-cb...
github_jupyter
# Lesson 4: Deploy your first domain node with Hagrid <b><u>Instructors</b></u>: Ishan Mishra, Phil Culliton This tutorial is a step-by-step walkthrough of how to <b>setup your domain node </b> for the very first time. This will enable you to start your peer-to-peer network of data owner and data scientists and coll...
github_jupyter
``` %load_ext sql %sql ibm_db_sa://***@dashdb-txn-sbox-yp-dal09-14.services.dal.bluemix.net:50000/BLUDB ``` #Problem 1: Find the total number of crimes recorded in the crime table. ``` %%sql select COUNT(*) as Number_of_Crimes from CHICAGO_CRIME_DATA LIMIT 10 ``` Problem 2: Retrieve first 10 rows from the CRIME tab...
github_jupyter
# Debug housing price predictions This notebook demonstrates the use of the AzureML RAI components to assess a classification model trained on Kaggle's apartments dataset (https://www.kaggle.com/alphaepsilon/housing-prices-dataset). The model predicts if the house sells for more than median price or not. It is a reimp...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') import torch.nn as nn import torch.nn.functional as F import pandas as pd import numpy as np import matplotlib.pyplot as plt import torch import torchvision import torchvision.transforms as transforms from torch.utils.data import Dataset, DataLoader fro...
github_jupyter
# Metrics - SST2 (id) ## Setup ``` from sklearn.metrics import roc_auc_score, roc_curve import numpy as np def compute_auroc(id_pps, ood_pps, normalize=False, return_curve=False): y = np.concatenate((np.ones_like(ood_pps), np.zeros_like(id_pps))) scores = np.concatenate((ood_pps, id_pps)) if normalize: ...
github_jupyter
# Compare Gal4 to biomarkers ``` import os import sys import re from pathlib import Path from io import StringIO from IPython.display import display, HTML, Markdown import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns # Project level imports from larv...
github_jupyter
# Robert Koch-Institut: COVID-19-Dashboard Data from https://experience.arcgis.com/experience/478220a4c454480e823b17327b2bf1d4 dashboard using the arcgis REST API. ``` import pandas as pd import requests import json from datetime import datetime import re import pycountry # papermill parameters output_folder = "../ou...
github_jupyter
``` # Copyright 2021 NVIDIA Corporation. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
github_jupyter
# Introduction to Linear Regression ## Learning Objectives 1. Analyze a Pandas Dataframe 2. Create Seaborn plots for Exporatory Data Analysis 2. Train a Linear Regression Model using Scikit-Learn ## Introduction This lab is in introduction to linear regression using Python and Scikit-Learn. This lab serves as...
github_jupyter
# MT Quality Score Calculator for Embedding-based Metrics This is a Jupyter Notebook for calculating modern embedding-based metrics for MT quality evaluation, here *BERTScore* and *COMET*. Traditional MT quality scores such as F-Measure, BLEU or TER rely on exact string matching to calculate the similarity or dissimila...
github_jupyter
``` import numpy as np import constants import quaternion as qt import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def RK4(f, x0x1, y0, step, step_process = lambda y: y): # f MUST takes x and y as arguments: f(x, y) # It solves equation y' = f(x, y), y(x0) = y0 (everything is a vector) ...
github_jupyter
# Optimization of a State-to-State Transfer in a Lambda System in the RWA ``` # NBVAL_IGNORE_OUTPUT %load_ext watermark import os import numpy as np import scipy import matplotlib import matplotlib.pylab as plt import krotov import qutip from qutip import Qobj %watermark -v --iversions ``` $\newcommand{tr}[0]{\operat...
github_jupyter
## Kubeflow Primitives Examples Kubeflow supports many machine learning and deep learnin frameworks. Katib provides hyper parameter tunning We will run Katib Experiments using `TFjob` and `PyTorchJob` ### Tensorlow Job (TFJob) ``` !kubectl create -f tfjob-example.yaml ``` If you check manifest, you will see ```...
github_jupyter
<font size = 1 color="gray">Introducción a la computación numérica y simbólica con Python</font> <img src="img/logo-vector-u-tad.jpg" align="left" > # 1. Introducción a NumPy, SciPy y Matplotlib En esta primera lección vamos a ver algunos ejemplos muy simples de uso de los paquetes de cálculo numérico NumPy y SciPy...
github_jupyter
``` #!conda install pytorch==1.7.1 torchvision !pip install ftfy regex tqdm !pip install git+https://github.com/openai/CLIP.git ``` ### clip zero-shot ``` import torch import clip from PIL import Image device = "cuda" if torch.cuda.is_available() else "cpu" model, preprocess = clip.load("ViT-B/32", device=device) in...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W3D4_ReinforcementLearning/W3D4_Tutorial4.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Tutorial 4: From Reinforcement Learning to Planning ...
github_jupyter
# Constellation and Chain Analysis: Transmitters and Receivers Example <img src="TransmitterAndReceiver.jpg" alt="Drawing" style="width: 800px;"/> **Terminology** * Node = Object in STK * Edge = Access between two objects in STK * Strand = The sequence of nodes and edges to complete access in a chain **This notebook...
github_jupyter
``` import os import json import dimensions_search_api_client as dscli import RichContextAPI import pandas as pd datasets_path = "/Users/sophierand/RCDatasets/datasets.json" with open(datasets_path) as json_file: datasets = json.load(json_file) def flatten(l): fl = [item for sublist in l for item in sublist] ...
github_jupyter
<a href="https://colab.research.google.com/github/mincloud1501/Bokeh/blob/master/googlesheet.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Getting setup Install boketh `pip install bokeh`. Setup-test, run the next cell. Hopefully you should see...
github_jupyter
``` import cudf import nvstrings import rmm import numpy as np lines = [ 'this IS a', 'word COUNT TEST', 'with a few word repeats', 'and some junk filler words' ] test_strings = nvstrings.to_device(lines) # lowercase all words tmp = test_strings.lower() # remove stop words for word in ['some', 'junk', 'filler']...
github_jupyter
# k-NN实现 大家都知道k-NN,即k邻近。今天我们用Python来实现它。 ``` iris_data=""" 5.1,3.5,1.4,0.2,Iris-setosa 4.9,3.0,1.4,0.2,Iris-setosa 4.7,3.2,1.3,0.2,Iris-setosa 4.6,3.1,1.5,0.2,Iris-setosa 5.0,3.6,1.4,0.2,Iris-setosa 5.4,3.9,1.7,0.4,Iris-setosa 4.6,3.4,1.4,0.3,Iris-setosa 5.0,3.4,1.5,0.2,Iris-setosa 4.4,2.9,1.4,0.2,Iris-setosa 4.9,3.1...
github_jupyter
# Balanced Network De-embedding Demonstration of *balanced*, i.e. 2N-port, network de-embedding. ## Setup ``` import numpy as np import skrf as rf from skrf.media import CPW rf.stylely() import matplotlib.pyplot as plt # base parameters freq = rf.Frequency(1e-3,10,1001,'ghz') cpw = CPW(freq, w=0.6e-3, s=0.25e-3, ...
github_jupyter
# Lesson - Machine Learning II: Evaluating Model Performance We have developed a function that can predict the price for any living space we want to list as long as we know the number of people it can accommodate. The function we have written represents a **machine learning model**, which means that it outputs a predi...
github_jupyter
# Overview: Extinction Modeling This notebook provides an example of how to use output stellar posterior samples (from `BruteForce` or other sources) in `brutus` to model the 3-D distribution of dust via extinction. # Preamble As always, let's just set up a nice environment to run these tests. ``` from __future__ i...
github_jupyter
``` import pandas as pd import numpy as np import random import os import sys from time import time import datetime from scipy.optimize import minimize, fsolve from collections import Counter from sklearn.metrics import log_loss from sklearn.decomposition import PCA from sklearn.preprocessing import MinMaxScaler from...
github_jupyter
# Visualizing Grover's Search Algorithm This is a companion notebook to the [Exploring Grover's Search Algorithm](./ExploringGroversAlgorithmTutorial.ipynb) tutorial. It helps you explore the algorithm by plotting several graphs that are a lot easier to build using Python than in a purely Q# notebook. > <font color="...
github_jupyter
# Mount Drive ``` from google.colab import drive drive.mount('/content/drive') ``` # Install packages List of packages that work for the code * https://github.com/saeed-anwar/DRLN/issues/12 ``` !pip uninstall --y torchvision !pip uninstall --y torch !pip uninstall --y scipy !pip install -q torch==1.1.0 torchvision...
github_jupyter
<a href="https://www.bigdatauniversity.com"><img src="https://ibm.box.com/shared/static/cw2c7r3o20w9zn8gkecaeyjhgw3xdgbj.png" width="400" align="center"></a> <h1><center>Multiple Linear Regression</center></h1> <h4>About this Notebook</h4> In this notebook, we learn how to use scikit-learn to implement Multiple linea...
github_jupyter
# Converters for Quadratic Programs Optimization problems in Qiskit's optimization module are represented with the `QuadraticProgram` class, which is a generic and powerful representation for optimization problems. In general, optimization algorithms are defined for a certain formulation of a quadratic program, and we...
github_jupyter
<h1><center><font size="6">Hyperparameter Tuning Notebook</font></center></h1> # Contents - <a href='#1'>Importing Packages</a> - <a href='#2'>Preparing Data for Modeling</a> - <a href='#3'>Hyperparameter Tuning</a> - <a href='#31'>Logistic Regression with GridSearchCV</a> - <a href='#32'>Random Forest Clas...
github_jupyter
<i>Copyright (c) Microsoft Corporation. All rights reserved.</i> <i>Licensed under the MIT License.</i> # Estimating Baseline Performance <br> Estimating baseline performance is as important as choosing right metrics for model evaluation. In this notebook, we briefly discuss about why do we care about baseline perfor...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sb from sklearn import metrics from datetime import datetime from pandas_profiling import ProfileReport # installer packages !pip uninstall --yes !pip install --yes !conda install -c anaconda pandas-profiling --yes #lister tous...
github_jupyter
### In this notebook, we will analyze csv and json files with pandas and numpy, then plot with Bokeh, to visualize how your favorite sports team really is going to be the death of you. ``` #import the needed modules -- we have some extra bokeh packages in case we want to apply more stylings. import json import pandas ...
github_jupyter
# Data science in Python - Course GitHub repo: https://github.com/pycam/python-data-science - Python website: https://www.python.org/ ## Session 1.2: Using existing python modules to explore data in files - [Importing module `statistics`](#Importing-module-statistics) - [Exercise 1.2.1](#Exercise-1.2.1) - [Python...
github_jupyter
``` import syft as sy ``` # Domain Applies to Network ``` import syft as sy sy.networks un = sy.networks[1] un.search("https://aclanthology.org/P07-2045.pdf") un.domains ca = un.domains[0] ca.routes[0].connection.base_url out = sy.login(email="info@openmined.org", password="changethis", port=8081) sy.register(name="A...
github_jupyter
Lgal mini mocha data set looks strange because the stellar mass and redshift are highly correlated. All of the $r$ magnitudes are roughly 19.5 ``` import os import numpy as np from gqp_mc import data as Data # --- plotting --- import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.ticker as tick...
github_jupyter
[🥭 Mango Markets](https://mango.markets/) support is available at: [Docs](https://docs.mango.markets/) | [Discord](https://discord.gg/67jySBhxrg) | [Twitter](https://twitter.com/mangomarkets) | [Github](https://github.com/blockworks-foundation) | [Email](mailto:hello@blockworks.foundation) [![Binder](https://mybinder...
github_jupyter
``` import pandas as pd pd.set_option("display.max_columns",250) import os import numpy as np import matplotlib import matplotlib.pyplot as plt import seaborn as sns import xlsxwriter import yaml as yaml sns.set() with open(r'E:/Projects/Clients/MetCouncilASIM/tasks/survey_data_processing/metc_inputs.yml') as file: ...
github_jupyter
## Trimming Characters from Strings Let us go through how to trim unwanted characters using Spark Functions. ``` %%HTML <iframe width="560" height="315" src="https://www.youtube.com/embed/qWv8zfSOPZM?rel=0&amp;controls=1&amp;showinfo=0" frameborder="0" allowfullscreen></iframe> ``` * We typically use trimming to remo...
github_jupyter
* basic roberta ft: 0.6589791487657798 (thr 0.3) * basic roberta ft (head first): 0.6768011808573329 (thr 0.42) * fine tune roberta on weird clf, then only head on spans, then whole: 0.6853127403287083 (thr 0.32) * ``` from transformers import RobertaTokenizer, RobertaForTokenClassification from transformers import Be...
github_jupyter
# Detect and Delete outliers with Optimus An outlier is an observation that lies an abnormal distance from other values in a random sample from a population. In a sense, this definition leaves it up to the analyst (or a consensus process) to decide what will be considered abnormal. Before abnormal observations can be ...
github_jupyter
<a href="https://colab.research.google.com/github/sibyjackgrove/SolarPV-DER-simulation-utility/blob/master/examples/PV-DER_usage_example.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Accessing and updating model parameters ### Import classes I...
github_jupyter
``` %matplotlib notebook import matplotlib.pyplot as plt from matplotlib_scalebar.scalebar import ScaleBar import numpy as np from colicoords import Cell, load, CellPlot, iter_subplots, IterCellPlot, CellListPlot from colicoords.support import pad_cell from colicoords.config import cfg import tifffile import os data_di...
github_jupyter
# 注意 这个例子因为年久失修,已经跑不起来了。网上推荐看 rbg 的 faster-rcnn 代码。 [R-CNN](https://github.com/rbgirshick/rcnn) is a state-of-the-art detector that classifies region proposals by a finetuned Caffe model. For the full details of the R-CNN system and model, refer to its project site and the paper: > *Rich feature hierarchies for accu...
github_jupyter
``` import pickle import pandas as pd from sklearn.preprocessing import StandardScaler, MinMaxScaler import numpy as np import matplotlib.pyplot as plt import seaborn as sns import os from copy import copy def load_pickle(filename): with open(filename, 'rb') as f: return pickle.load(f) # might be pickle.lo...
github_jupyter
``` import pandas as pd from pathlib import Path train_csv_file = Path('./train.csv') traincsv = pd.read_csv(train_csv_file, usecols=[1, 4]) traincsv.replace('\s', '-', regex=True) train_csv = traincsv.replace('/', '_', regex=True) traincsv.to_csv('train_only_labels.csv', index=False) def all_cols_to_only_labels(inp_cs...
github_jupyter
# eICU Collaborative Research Database # Notebook 1: Accessing the data The aim of this notebook is to get set up with access to a demo version of the [eICU Collaborative Research Database](http://eicu-crd.mit.edu/). The demo is a subset of the full database, limited to 100 patients. ## Prerequisites - If you do no...
github_jupyter
# Regression with Amazon SageMaker XGBoost algorithm _**Distributed training for regression with Amazon SageMaker XGBoost script mode**_ --- ## Contents 1. [Introduction](#Introduction) 2. [Setup](#Setup) 1. [Fetching the dataset](#Fetching-the-dataset) 2. [Data Ingestion](#Data-ingestion) 3. [Training the XGBoos...
github_jupyter
``` from __future__ import print_function, division import os import sys spark_home = os.environ['SPARK_HOME'] sys.path.insert(0, os.path.join(spark_home, 'python')) sys.path.insert(0, os.path.join(spark_home, 'python/lib/py4j-0.10.4-src.zip')) from pyspark.sql import SparkSession spark = SparkSession.builder.master...
github_jupyter
Linear Regression =============== <div class="overview-this-is-a-title overview"> <p class="overview-title">Overview</p> <p>Questions</p> <ul> <li>How can I complete linear regression with statistics in Python? </ul> <p>Objectives:</p> <ul> <li>Use a pandas dataframe for data analysis ...
github_jupyter
# Initialization Test notebook for the C-MAPPS benchmark. Test different MLP architectures. First we import the necessary packages and create the global variables. ``` import math import numpy as np import csv import copy from scipy import stats from sklearn.preprocessing import StandardScaler, MinMaxScaler import...
github_jupyter
``` %matplotlib inline import gym import matplotlib import numpy as np import sys from collections import defaultdict if "../" not in sys.path: sys.path.append("../") from lib.envs.blackjack import BlackjackEnv from lib import plotting matplotlib.style.use('ggplot') env = BlackjackEnv() def create_random_policy(n...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Reducer/stats_of_an_image_region.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_bla...
github_jupyter
<img src="../img/logo_amds.png" alt="Logo" style="width: 128px;"/> # AmsterdamUMCdb - Freely Accessible ICU Database version 1.0.1 January 2020 Copyright &copy; 2003-2020 Amsterdam UMC - Amsterdam Medical Data Science # <a id='processitems'></a>processitems table The *processitems* table contains all catheters, dr...
github_jupyter
# Visualize your location history with Python and Leaflet See [this blog post](http://geoffboeing.com/2016/06/mapping-everywhere-ever-been/) for my full write-up of this project. This project collects, clusters, geocodes, merges, and now visualizes location history data from Foursquare, Google, and a spreadsheet of p...
github_jupyter
# ADVANCED SQL 1: Window Functions & Percentiles Window Functions is one of the most powerful concepts in SQL data analysis. The Window Function allows us to compare one row to another without doing any joins. This can allow us do simple things like create a running-total as well as tricky things like determine if on...
github_jupyter
### 上期所写入数据库 ``` from bs4 import BeautifulSoup import urllib.parse import pandas as pd import re import pandas as pd def askURL(url): head = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Edg/89.0.774.63"} req = urllib.request....
github_jupyter
<a href="https://colab.research.google.com/github/Lawan-L/LinearProgramming/blob/main/simplex.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` from scipy.optimize import linprog ``` # Simplex à 2 variables ``` obj = [-1, -2] # ─┬ ─┬ # ...
github_jupyter
<a href="https://colab.research.google.com/github/HeyLaxmi/DS-Unit-1-Sprint-1-Dealing-With-Data/blob/master/LS_DS_114_Making_Data_backed_Assertions.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Lambda School Data Science - Making Data-backed Ass...
github_jupyter
# 两个融合 ``` import csv import numpy as np with open('/home/freedom/caffe/tianchifusai/InceptionV3/20180522/result2/result.csv','r') as a: reader = csv.reader(a) rows_a = [row for row in reader] with open('/home/freedom/caffe/tianchifusai/InceptionV3/20180522/result2/submission.csv','r') as b: reader = csv....
github_jupyter
``` #make sure you are in gis-env to run this code #try to read in gis files import shapefile import numpy as np import matplotlib.pyplot as plt import geopandas as gpd import matplotlib from shapely.geometry import Polygon import pyproj from shapely.geometry import Point import matplotlib.path as mpltPath from shapely...
github_jupyter
# 1.0 IMPORT ``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import warnings import re from scipy import stats as ss from geopy.geocoders import Nominatim from tqdm import tqdm warnings.filterwarnings('ignore') ``` ## 1.1 Helper Fuctions ``` def grafdisplot(dt): ...
github_jupyter
``` import re import json import editdistance import numpy as np import pandas as pd from tqdm import tqdm from collections import Counter from PIL import Image import os from matplotlib import font_manager as fm, rcParams from nltk.tokenize import sent_tokenize from unidecode import unidecode from rich import print ...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt Pre_data = pd.read_csv("C:\\Users\\2019A00303\\Desktop\\Code\\Airbnb Project\\Data\\PreProcessingBelgium.csv") Pre_data Pre_data['Price'].plot(kind='hist', bins=100) Pre_data['group'] = pd.cut(x=Pre_data['Price'], bins=[0, 50, 100, 150, 200, 10...
github_jupyter
### Scroll Down Below to start from Exercise 8.04 ``` # Removes Warnings import warnings warnings.filterwarnings('ignore') #import the necessary packages import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns ``` ## Reading the data using pandas ``` data= pd.read_csv('Churn_Mode...
github_jupyter
# Bayesian Optimization for Rosenbrock Function ``` %load_ext autoreload %autoreload 2 import numpy as np from scipy.optimize import rosen from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C import matplotlib.pyplot as plt %matplotlib inl...
github_jupyter
``` # lists are mutable # lists are like arrays in java except it can store any datatype l1 = [] print(type(l1)) l2 = [1,2,3] print(type(l2)) l3 = [1, 2.34, "aaa", True] print(type(l3)) l4 = list() print(l4) print(type(l4)) l5 = list(l2) print(type(l5)) print(l5) l6 = list("abc123") print(l6) # another way of cre...
github_jupyter
# Simple `openrouteservice-py` examples This notebook is just a small reference on how to use `openrouteservice` package to request: - [directions](https://openrouteservice.org/dev) - [isochrones](https://openrouteservice.org/dev/#/api-docs/v2/isochrones/{profile}/post) - [matrix](https://openrouteservice.org/dev/#/ap...
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
### Sea Level Rise in New York City Data Bootcamp Final Project (Spring 2016) by Daniel Jung (dmj307@stern.nyu.edu) ** About This Project ** The levels of ocean surfaces (henceforth referred to as the 'sea level') have been observed to be rising around the world. While sea levels are known to fluctuate due to natur...
github_jupyter
# Configuration ``` import os from tqdm.notebook import tqdm from tqdm import tqdm import librosa import pandas as pd import pandas as np from sklearn.metrics import classification_report ``` # Clean Data - Compute dataframes for datasets and split in Train, Val, Test ``` main_path = '/Users/helemanc/Documents/Mast...
github_jupyter
``` # import packages import warnings warnings.filterwarnings('ignore') import numpy as np import pandas as pd from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score from sklearn.metrics import precision_score from sklearn.metrics import recall_sco...
github_jupyter