code
stringlengths
2.5k
150k
kind
stringclasses
1 value
``` ###################### Query 1 ##################### from pyspark.sql import SparkSession spark = SparkSession\ .builder\ .master('yarn-client')\ .appName("TPCH_Q1")\ .getOrCreate() df = spark.read.format("parquet").load("/orin_tpchnp_100/lineitem") df.createOrReplaceTempView("linei...
github_jupyter
``` %run ../Python_files/util.py ##### read in raw data import openpyxl data_folder = '/home/jzh/Dropbox/Research/\ Data-driven_estimation_inverse_optimization/INRIX/Raw_data/' # load filtered INRIX attribute table raw data wb_INRIX = openpyxl.load_workbook(data_folder + 'filtered_INRIX_attribute_table.xlsx') # lo...
github_jupyter
# pipda A framework for data piping in python Inspired by [siuba][1], [dfply][2], [plydata][3] and [dplython][4], but with simple yet powerful APIs to mimic the `dplyr` and `tidyr` packages in python ## Installation ```shell pip install -U pipda ``` ## Usage Checkout [plyrda][6] for more detailed usages. ### Verb...
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
# Explaining random forest model predictions with Shapley values Shapley values provide an estimate of how much any particular feature influences the model decision. When Shapley values are averaged they provide a measure of the overall influence of a feature. Shapley values may be used across model types, and so pro...
github_jupyter
# FloPy ## MNW2 package example ``` from __future__ import print_function import sys import os import numpy as np try: import pandas as pd except: pass # run installed version of flopy or add local path try: import flopy except: fpth = os.path.abspath(os.path.join('..', '..')) sys.path.append(fpt...
github_jupyter
# "You get a decision tree! And YOU get a decision tree!" > "Oprah was so close to discovering random forests." - comments: true - categories: [tabular] Our first method for training structured tabular data is to use ensembles of decision trees. --- **Decision trees**: a decision tree asks a series of yes/no quest...
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
# Historical Variance Let's see how we'd be calculating a covariance matrix of assets without the help of a factor model ``` import sys !{sys.executable} -m pip install -r requirements.txt import numpy as np import pandas as pd import time import os import quiz_helper import matplotlib.pyplot as plt %matplotlib inlin...
github_jupyter
``` pwd import pandas as pd import numpy as np df_csv= pd.read_pickle("../df_noplus/df5.pkl") all_subjects=df_csv['COURSEID'].value_counts() ##removing any subject enrolled less than 20 times #all_subjects=all_subjects[all_subjects>=20] print df_csv.shape df_csv=df_csv[df_csv["COURSEID"].isin(all_subjects.index)] print...
github_jupyter
# First look at our dataset In this notebook, we will look at the necessary steps required before any machine learning takes place. It involves: * loading the data; * looking at the variables in the dataset, in particular, differentiate between numerical and categorical variables, which need different preprocess...
github_jupyter
### Import necessary libraries, set options ``` import matplotlib.pyplot as plt import numpy as np import os import pandas as pd import patsy import seaborn as sns import statsmodels.api as sm import warnings from statsmodels.formula.api import glm pd.set_option('display.max_columns', 125) warnings.filterwarnings("i...
github_jupyter
# Indexing Dataframes ``` #a função set_index é um processo destrutivo e não mantém o index atual #se quisermos manter o index atual, precisamos manualmente criar uma nova coluna e copiá-los para ela #os valores import pandas as pd df = pd.read_csv('resources/week-1/datasets/Admission_Predict.csv', index_col=0) df.hea...
github_jupyter
## Preprocessing <!-- Was used to generate: <br> *preprocessed_data/cloud_cover_all_days_input_train_1.npy <br> preprocessed_data/cloud_cover_all_days_input_valid_1.npy <br> preprocessed_data/cloud_cover_all_days_output_train_1.npy <br> preprocessed_data/cloud_cover_all_days_output_valid_1.npy* --> ``` import sys imp...
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
<a href="https://colab.research.google.com/github/AlejandroBeltranA/OCVED-ML/blob/master/OCVED_Applied_v2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Classifying remaining articles This is the 4th of 4 scripts used in ocved.mx This script us...
github_jupyter
# Artificial Intelligence Nanodegree ## Voice User Interfaces ## Project: Speech Recognition with Neural Networks --- In this notebook, some template code has already been provided for you, and you will need to implement additional functionality to successfully complete this project. You will not need to modify the...
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
``` import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.metrics import roc_curve, roc_auc_score, precision_score, recall_score, f1_score, accuracy_score, confusion_matrix import glob import cv2 import random import tensorfl...
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
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt print("pandas", pd.__version__) print("numpy",np.__version__) ``` # Cookbook This is a repository for *short and sweet* examples and links for useful pandas recipes. We encourage users to add to this documentation. Adding interesting links an...
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
# Modeling: Aspect-Based Sentiment Analysis ## BerTweet Oversampling as a solution to the imabalance still wasn't enough to raise the model's performance significantly. This was especially the case because the validation and test sets were very small and still imbalanced (plus, we can't resample these!). Thus, my next...
github_jupyter
## VISUALIZING YOUR FAVOURITE NBA PLAYER 3 POINTERS GRAPH Tools we are going to use: - The NBA API to get the data from any NBA player - CARTOframes to upload the data seamlessly to CARTO - The CARTO Python SDK to analyze and create a 3-pointers map - carto-print to generate a high resolution ready-to-print image ##...
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
Clustering Mash distances to obtain clonal groups for all Salmonella ``` library('FactoMineR') library('factoextra') library('readxl') library('dplyr') mash_dist_file = '../data/interim/mash_distance_matrix.csv' meta_excel_file = '../data/raw/GenotypicAMR_Master.xlsx' distances <- read.csv(mash_dist_file, header=TRUE,...
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
# Deep Convolutional Generative Adversarial Networks :label:`sec_dcgan` In :numref:`sec_basic_gan`, we introduced the basic ideas behind how GANs work. We showed that they can draw samples from some simple, easy-to-sample distribution, like a uniform or normal distribution, and transform them into samples that appear ...
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 os.environ['PYSPARK_SUBMIT_ARGS'] = \ '--conf spark.cassandra.connection.host=cassandra --packages org.apache.spark:spark-streaming-kafka-0-8_2.11:2.0.2,com.datastax.spark:spark-cassandra-connector_2.11:2.0.2 pyspark-shell' from pyspark import SparkContext from pyspark.streaming import StreamingContext ...
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
<a href="https://colab.research.google.com/github/rtindru/CompStats/blob/master/Kensho_Assessment_Model.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.f...
github_jupyter
<h1 id="header-ch">2021 CCF BDCI基于飞桨实现花样滑冰选手骨骼点动作识别-第6名方案</h1> # 赛题介绍 人体运动分析是近几年许多领域研究的热点问题。在学科的交叉研究上,人体运动分析涉及到计算机科学、运动人体科学、环境行为学和材料科学等。随着研究的深入以及计算机视觉、5G通信的飞速发展,人体运动分析技术已应用于自动驾驶、影视创作、安防异常事件监测和体育竞技分析、康复等实际场景人体运动分析已成为人工智能领域研究的前沿课题。目前的研究数据普遍缺少细粒度语义信息,导致现存的分割或识别任务缺少时空细粒度动作语义模型。此类研究在竞技体育、运动康复、日常健身等方面有非常重大的意义。相比于图片的细粒度研究,时...
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
# Introduction to the scikit-learn -- supervised learning and model selection (part 3) - toc: true - badges: true - categories: [EEG, jupyter] - description: To visualize the workings of machine learning algorithms, it is often helpful to study two-dimensional or one-dimensional data, that is data with only one or tw...
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
<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
``` import numpy as np import matplotlib.pyplot as plt import scipy.stats as scy inds = np.arange(0, 50, 0.001) capacity = 20 y = 1/ (1 + np.exp( -0.1 * (inds - capacity / 2)) ) y[inds < 5] = 0 plt.plot(inds, y, label='Juveniles') y1 = y y1[inds >= 5] = 0.01 plt.plot(inds, y1, '-.', label='Adults') plt.text(20, 0.03...
github_jupyter
``` %load_ext itikz import itikz from itikz import nicematrix as nM import jinja2 import numpy as np import sympy as sym import panel as pn pn.extension() ## Invoke itikz without using cell magic # itikz.build_commands? # itikz.fetch_or_compile_svg? ``` # 1. Examples from the Original Itikz Notebook ``` %%...
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
``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline import warnings warnings.simplefilter(action='ignore', category=FutureWarning) df = pd.read_csv('credit.csv') df.head() df.shape df.info() df.isnull().sum() df.duplicated().sum() df.corr() df['default'].v...
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
``` import numpy as np import pandas as pd # stats from scipy import stats # Plotting import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns import math %matplotlib inline _df4 = pd.read_csv('winequality-red.csv',sep=";") _df4 # _df4.head() ``` # Basics of MatPlotLib # Pylab interface, whe...
github_jupyter
## "FAQ-Style QA": Utilizing existing FAQs for Question Answering While *extractive Question Answering* works on pure texts and is therefore more generalizable, there's also a common alternative that utilizes existing FAQ data. Pros: - Very fast at inference time - Utilize existing FAQ data - Quite good control over ...
github_jupyter
## **Variables and Data Types** **Topics Covered** > Creating Variable > DataTypes > None Keyword > Multi Line statement and Multi Comment ----- ### Creating a Variable * Variables are used to store values. In Python you don't have to declare a varaible. * Variable is created the moment you ...
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
*Note: This is not yet ready, but shows the direction I'm leaning in for Fourth Edition Search.* # State-Space Search This notebook describes several state-space search algorithms, and how they can be used to solve a variety of problems. We start with a simple algorithm and a simple domain: finding a route from city ...
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
``` %tensorflow_version 1.x import numpy as np import pandas as pd import sklearn import sklearn.metrics from sklearn import tree from matplotlib import pyplot as plt %load_ext autoreload %autoreload 2 import torch from torch.autograd import Variable as V import torchvision.models as models from torchvision import tr...
github_jupyter
### Load SEM image Import packages ``` from PIL import Image import numpy as np import time import matplotlib.pyplot as plt import cv2 import copy # from skimage import io # from skimage.io import imread, imshow # from skimage.filters import threshold_otsu # from skimage import color # from skimage.color import label...
github_jupyter
# Materialien zu <i>zufall</i> Autor: Holger Böttcher - hbomat@posteo.de ## Aufgaben 13 - Simulation (Probleme von Leibniz <br>und de Méré) <br> ### Problem von Leibniz Leibniz nahm fälschlicherweise an, dass beim Werfen von 2 Würfeln die Augensumme<br> 11 genau so oft auftritt wie die Augensumme 12<br> ``` %run zu...
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
# Parte 3 - Machine Learning Workflow Datasets: [Diamanti](https://www.kaggle.com/shivam2503/diamonds) **OBBIETTVO:** In base alle sue caratteristiche provare a predire il prezzo di un diamante <br> Utilizzeremo la libreria python **scikit-learn** per testare alcuni algoritmi di classificiazione! ``` import pandas a...
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
``` import numpy as np import pandas as pd import os from pathlib import Path import selfies as sf from rdkit import Chem import pandas as pd ``` # Molecule retrieval from Zinc20 smi files ``` Is_data_prepared = True if not Is_data_prepared: tranche_dirs = ['FK', 'DC', 'BB', 'JA', 'HE', 'GA', 'KG', 'IC', 'CB...
github_jupyter
# Python: ## basic features https://www.python.org/ ``` print("Hello, World!") a = 5 b = 2 a + b 1 + a * b a ** b # different in python 3: a//b # for same behaviour run: from __future__ import division a / b a / float(b) a % b min(a, b) a == b a != b a += 3 a # Python Lists a = [1, "hello", 5.5] a len(a) a[2] a.appe...
github_jupyter
# Compare tangential shear profiles from the extragalactic and object catalogs for DC2 Run 2.1i This notebook can be run at NERSC or CC-IN2P3 where the DESC DC2 products are stored. You need to be a DESC member to be able to access those. The DC2 catalog-related imports below (`FoFCatalogMatching`, `GCR` and `GCRCatal...
github_jupyter
# User Study ``` import pandas as pd import numpy as np import math import time eval_dir = "gc_imdb" # df = pd.read_csv("../data/" + eval_dir + "/test.csv", header=None, sep="\t", names=[0, 1, "mutant", "template", "gender", "label", "country"]) df = pd.read_csv("../data/" + eval_dir + "/test.csv", header=None, sep="\...
github_jupyter
# SageMaker Debugger Profiling Report SageMaker Debugger auto generated this report. You can generate similar reports on all supported training jobs. The report provides summary of training job, system resource usage statistics, framework metrics, rules summary, and detailed analysis from each rule. The graphs and tab...
github_jupyter
``` import pandas as pd import numpy as np data = pd.Series(np.random.randn(9), index=[['a', 'a', 'a', 'b', 'b', 'c', 'c', 'd', 'd'], [1, 2, 3, 1, 3, 1, 2, 2, 3]]) data data.index data['b'] data['b':'c'] data.loc[['b','d']] data.loc[:,2] data.unstack() data.unstack().stack() fra...
github_jupyter
``` import numpy as np import regex as re import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import statistics import math import os import keras.backend as K from sklearn.model_selection import StratifiedKFold from sklearn.metrics import accuracy_score from sklearn.model_selection import train_t...
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
# Description : This is a emotion analysis program that parses the tweets fetched from Twitter using Python ``` # import libraries import tweepy from textblob import TextBlob from wordcloud import WordCloud import pandas as pd import numpy as np import re import matplotlib.pyplot as plt plt.style.use('fivethirtyeight...
github_jupyter
``` !git clone https://github.com/parhamzm/Beijing-Pollution-DataSet !ls Beijing-Pollution-DataSet import torch import torchvision import torch.nn as nn from torchvision import transforms import pandas as pd import matplotlib.pyplot as plt import numpy as np from torch.utils.data import random_split from math import...
github_jupyter
# Treasure Hunt Game Notebook ## Read and Review Your Starter Code The theme of this project is a popular treasure hunt game in which the player needs to find the treasure before the pirate does. While you will not be developing the entire game, you will write the part of the game that represents the intelligent agent...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') cd drive/My Drive/google_colab_gpu/GSOC 2020/CERN-HSF ls #import cv2 import numpy as np import pandas as pd #from google.colab.patches import cv2_imshow import h5py #import numpy as np #import matplotlib.pyplot as plt import pandas as pd import warnings w...
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
# Rolling Update Tests Check rolling updates function as expected. ``` import json import time !kubectl create namespace seldon !kubectl config set-context $(kubectl config current-context) --namespace=seldon ``` ## Change Image ``` !kubectl apply -f resources/fixed_v1.yaml !kubectl rollout status deploy/$(kubectl ...
github_jupyter
# Hypothesis and Inference In this chapter, we test hypotheses. Firstly, let's test the hypothesis that a series of coin flips will be fair. It also build upon previous functions found in earlier chapters. ### Assumptions: 1. each flip is a Bernoulli trial, meaning that `X` a binomial `(n,p)` random variable. 2. `...
github_jupyter
# Homework 8 ## Due Date: Tuesday, October 31st at 11:59 PM # Problem 1: BST Traversal This problem builds on Problem 1 of Homework 7 in which you wrote a binary search tree. ### Part 1 As discussed in lecture, three different types to do a depth-first traversal are: preorder, inorder, and postorder. Here is a ref...
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
# 数学函数、字符串和对象 ## 本章介绍Python函数来执行常见的数学运算 - 函数是完成一个特殊任务的一组语句,可以理解为一个函数相当于一个小功能,但是在开发中,需要注意一个函数的长度最好不要超过一屏 - Python中的内置函数是不需要Import导入的 <img src="../Photo/15.png"></img> ``` #绝对值 print(abs(-10)) #MAX max(1,2,3) #max('abc') #MIN min(-1,0,1) #POW(幂) pow(5,8) #ROUND(X)(返回与X最接近的整数) round(3.8) #round(x,n) 保留浮点小数 round(3.99999...
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
# Esercitazione 1 ## Esercizio ### Analisi del segnale Apriamo il segnale da analizzare con [Audacity](https://www.audacityteam.org/). Ascoltandolo possiamo chiaramente riconoscere una sequenza di tasti premuti su un tastierino telefonico, anche conosciuto come [DTMF](https://en.wikipedia.org/wiki/Dual-tone_multi-fr...
github_jupyter