text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Demographic Data Analyzer In this challenge you must analyze demographic data using Pandas. You are given a dataset of demographic data that was extracted from the 1994 Census database. Here is a sample of what the data looks like: | | age | workclass | fnlwgt | education | education-num | marital...
github_jupyter
# Deep Learning & Art: Neural Style Transfer In this assignment, you will learn about Neural Style Transfer. This algorithm was created by [Gatys et al. (2015).](https://arxiv.org/abs/1508.06576) **In this assignment, you will:** - Implement the neural style transfer algorithm - Generate novel artistic images using ...
github_jupyter
``` from openpyxl import load_workbook import requests.api import warnings from openpyxl import Workbook import random import re from time import sleep import urllib import urllib3 import requests from bs4 import BeautifulSoup from collections import OrderedDict forsvaingall=[] urllib3.disable_warnings() headers = {'Us...
github_jupyter
# How to use Geogebra with Jupyter notebooks [GeoGebra](geogebra.org) is a powerful tool for creating interactive classroom materials and visualizations that many teachers are familiar with. One limitation of GeoGebra is the distribution of these materials. While GeoGebra allows a teacher to export their material to t...
github_jupyter
# Analysis of the London Rental Property Market Analysis of the London rental property market based on all rental listings added to <a href="http://www.rightmove.co.uk" _target="blank">rightmove</a> in the last 24 hours. ``` # Setup: import os, sys sys.path.append(os.path.dirname(os.getcwd())) from rightmove_webscrape...
github_jupyter
# Analysis and visualization of 3D data in Python Daniela Ushizima, Alexandre de Siqueira, Stéfan van der Walt _BIDS @ University of California, Berkeley_ _Lawrence Berkeley National Laboratory - LBNL_ * Support material for the tutorial _Analysis and visualization of 3D data in Python_. This tutorial will introdu...
github_jupyter
# Reinforcement Learning Control Center Example This notebook provides an example code for how to integrate the RL Control Center into an existing training pipeline. To learn more about the RL Control Center, read here: https://medium.com/p/4f27b134bb2a For more reinforcment learning tutorials, see: https://github.com...
github_jupyter
## Chosen algorithm : FV MC Prediction (In this case, first visit and every visit do not differ, as we have only one state action pair to visit at every episode start) ![FV Algorithm](FirstVisitAlgorithm.png) ``` %matplotlib inline import gym import matplotlib import numpy as np import sys from collections import ...
github_jupyter
<center><img src="src/bqplot.svg" width="50%"></center> # Repository: https://github.com/bloomberg/bqplot # Installation: `conda install -c conda-forge bqplot` ## Base plot ``` import numpy as np import bqplot.pyplot as plt x = np.linspace(0, 10, 20) y = x**3 fig = plt.figure(animation_duration=1000) scatter = plt....
github_jupyter
``` %matplotlib notebook import sys import pandas as pd import numpy as np import matplotlib.pyplot as plt import scipy as sp import IPython from IPython.display import display import sklearn from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier from sklearn.preprocess...
github_jupyter
``` import sys sys.path.append('..') import torch import numpy as np import pandas as pd import matplotlib.pyplot as plt from sympy import simplify_logic from lens.utils.base import validate_network from lens.utils.relu_nn import get_reduced_model, prune_features from lens import logic import lens torch.manual_seed(0...
github_jupyter
``` import numpy as np from numpy import mean from numpy import std from matplotlib import pyplot from sklearn.model_selection import KFold from keras.datasets import mnist from tensorflow.keras.utils import to_categorical from keras.models import Sequential from keras.layers import Conv2D from keras.layers import MaxP...
github_jupyter
# Introduction to Feature Columns **Learning Objectives** 1. Load a CSV file using [Pandas](https://pandas.pydata.org/) 2. Create an input pipeline using tf.data 3. Create multiple types of feature columns ## Introduction In this notebook, you classify structured data (e.g. tabular data in a CSV file) using [f...
github_jupyter
``` %matplotlib inline #%matplotlib ipympl %load_ext autoreload %autoreload 2 from pylab import * import pandas as pd #Define a function to load the data def load_data(start,end,ch,name="OKSeq",root="../data_hela/"): #Start and end are in kb #return x in kb and signalvalue data = {"OKSeq":"OKSeq_5kb.cs...
github_jupyter
# Practical session 1 - Some Python basics Course: [SDIA-Python](https://github.com/guilgautier/sdia-python) Dates: 09/21/2021-09/22/2021 Instructor: [Guillaume Gautier](https://guilgautier.github.io/) Students (pair): - [Student 1]([link](https://github.com/username1)) - [Student 2]([link](https://github.com/usern...
github_jupyter
# Poisson HMM Demo ## Applying an HMM to electrophysiology data from a motor-control task In this notebook, we'll show how SSM can be used for modeling neuroscience data. This notebook is based off the 2008 paper ["Detecting Neural-State Transitions Using Hidden Markov Models for Motor Cortical Prostheses"](https://we...
github_jupyter
``` import numpy as np import scipy.sparse as sp import matplotlib.pyplot as plt from SimPEG import Mesh, Utils, Solver from scipy.constants import mu_0, epsilon_0 %matplotlib inline ``` # Sensitivity computuation for 1D magnetotelluric (MT) problem ## Purpose With [SimPEG's](http://simpeg.xyz) mesh class, we disc...
github_jupyter
# NHDPlusV1 Flowlines into Data Distillery Gc2 This code is in progress and is testing the use of Python to extract data from ScienceBase, add registration information, and export data into Data Distillery Gc2. General workflow involves: 1: Identify needed data in ScienceBase 2: Request data from ScienceBase by NHD...
github_jupyter
# Visualisierung von Netzwerkgraphen Bokeh unterstützt nativ die Erstellung von Netzwerkgraphen mit konfigurierbaren Interaktionen zwischen Kanten und Knoten. ## Edge- und Node-Renderer Das Hauptmerkmal von `GraphRenderer` ist, dass es separate GlyphRenderer für Diagrammknoten und Diagrammkanten gibt. Dies ermöglic...
github_jupyter
``` import pandas as pd import tldextract import numpy as np pd.options.mode.chained_assignment = None ``` Read in the original dataset of 19K websites, as well as the 11K websites we retrieved product pages from. ``` web19k = pd.read_csv('../../data/final-list/shopping-english.csv') web11k = pd.read_csv('../../data/...
github_jupyter
# Settings ``` EXP_NO = 38 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 = 0.80 PAST_EXPERIMENTS = tuple(exp_no for exp_no in range(4, 28 + 1) # 7 は予測...
github_jupyter
``` import pandas as pd df = pd.read_csv('../results/mai_doc2vec_sim.csv') df import spacy nlp = spacy.load('ja_ginza') for p in nlp.pipeline: print(p) import textdistance # text_pair = df.sort_values('SIM', ascending=False).iloc[203][['T2_Mai', 'T2_Maisho', 'SIM']].values.flatten() text_pair = df.sample(1)[['T2_Ma...
github_jupyter
# Exercise 20 - CostSensitive Churn [paper](http://download.springer.com/static/pdf/125/art%253A10.1186%252Fs40165-015-0014-6.pdf?originUrl=http%3A%2F%2Fdecisionanalyticsjournal.springeropen.com%2Farticle%2F10.1186%2Fs40165-015-0014-6&token2=exp=1462974790~acl=%2Fstatic%2Fpdf%2F125%2Fart%25253A10.1186%25252Fs40165-015...
github_jupyter
# Support Vector Regression with MinMaxScaler and QuantileTransformer This Code template is for regression analysis using simple Support Vector Regressor(SVR) based on the Support Vector Machine algorithm with feature rescaling technique MinMaxScaler and feature transformation technique QuantileTransformer in a pipeli...
github_jupyter
## https://pymoo.org/getting_started.html ``` !pip install pymoo==0.4.2.2 ``` ## Questions: - What are reference directions / how do they work? https://pymoo.org/misc/reference_directions.html ``` import numpy as np from pymoo.util.misc import stack from pymoo.model.problem import Problem class MyProblem(Problem):...
github_jupyter
High level: This notebook shows all the inconsistencies of field that were produced with dictionaries (and have hebrew in the name) with their respective numeric values for the markers_hebrew table. The specific analysis below is based on data from 2020-01-13_views_and_main_tables folder from Jan 12, 2020 that can be ...
github_jupyter
# Equivalent Layer technique for estimating magnetization direction of a magnetized source #### Importing libraries ``` % matplotlib inline import sys import numpy as np import matplotlib.pyplot as plt import cPickle as pickle import datetime import timeit from scipy.optimize import nnls from fatiando.gridder import ...
github_jupyter
To most investors, short selling is a shadowy, mysterious corner of the markets. Many do not make use of shorting - and I suspect a majority don't understand how to glean insights from trends in short selling activity. Over the past several years, I've traded short about as often as long and have consequently learn...
github_jupyter
# testing on wellcome images We can now test our models' performance when transferred onto the Wellcome images dataset. In doing so, we'll get a better understanding of how well they generalise and which gaps in their knowledge we'll need to fill as we continue to modify them. ``` %matplotlib inline import matplotlib....
github_jupyter
# Classifying Images with pre-built TF Container on Vertex AI This notebook demonstrates how to implement different image models on MNIST using the [tf.keras API](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/keras). ## Learning Objectives 1. Understand how to build a Dense Neural Network (DNN) for imag...
github_jupyter
``` import numpy as np import urdf2casadi.urdfparser as u2c from urdf2casadi.geometry import plucker from urdf_parser_py.urdf import URDF, Pose from timeit import Timer, timeit, repeat import casadi as cs def median(lst): n = len(lst) if n < 1: return None if n % 2 == 1: return sort...
github_jupyter
<a href="https://colab.research.google.com/github/anoushkrit/MOOCs/blob/master/TensorFlow-in-Practice/Introduction-to-Tensorflow/Horse_or_Human_NoValidation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` !wget --no-check-certificate \ https...
github_jupyter
# Course set-up ``` __author__ = "Christopher Potts" __version__ = "CS224u, Stanford, Spring 2021" ``` This notebook covers the steps you'll need to take to get set up for [CS224u](http://web.stanford.edu/class/cs224u/). ## Contents 1. [Anaconda](#Anaconda) 1. [The course Github repository](#The-course-Github-repos...
github_jupyter
# REINFORCE in lasagne Just like we did before for q-learning, this time we'll design a lasagne network to learn `CartPole-v0` via policy gradient (REINFORCE). Most of the code in this notebook is taken from approximate qlearning, so you'll find it more or less familiar and even simpler. __Frameworks__ - we'll accep...
github_jupyter
``` %matplotlib inline from matplotlib import style style.use('fivethirtyeight') import matplotlib.pyplot as plt import numpy as np import pandas as pd import datetime as dt ``` # Reflect Tables into SQLAlchemy ORM ``` # Python SQL toolkit and Object Relational Mapper import sqlalchemy from sqlalchemy.ext.automap imp...
github_jupyter
``` !pip install dynet !git clone https://github.com/neubig/nn4nlp-code.git from __future__ import print_function import time from collections import defaultdict import random import math import sys import argparse import dynet as dy import numpy as np #the parameters from mixer NXENT = 40 NXER = 20 delta = 2 # form...
github_jupyter
# Assignment 2 Key ``` import pandas as pd import numpy as np ``` #### First let's load the dataset into dataframe df ``` df = pd.read_csv("train_set.csv") ``` #### Take a look at the dataset first and see how many variables it has. ``` df.head(5) ``` ### 1. (1 pt.) Convert the numeric claim_amount target to a...
github_jupyter
#Transformer ``` from google.colab import drive drive.mount('/content/drive') # informer, ARIMA, Prophet, LSTMa와는 다른 형식의 CSV를 사용한다.(Version2) !pip install pandas import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline df = pd.read_csv('/content/drive/MyDrive/Colab Notebooks/Data/...
github_jupyter
``` # default_exp uniformis #hide from nbdev.showdoc import * #hide # stellt sicher, dass beim verändern der core library diese wieder neu geladen wird %load_ext autoreload %autoreload 2 ``` # Uniform IS ## Basic Settings ``` # imports from bfh_mt_hs2020_sec_data.core import * from pathlib import Path from typing i...
github_jupyter
# How to define a compartment population model in Compartor $$ \def\n{\mathbf{n}} \def\x{\mathbf{x}} \def\N{\mathbb{\mathbb{N}}} \def\X{\mathbb{X}} \def\NX{\mathbb{\N_0^\X}} \def\C{\mathcal{C}} \def\Jc{\mathcal{J}_c} \def\DM{\Delta M_{c,j}} \newcommand\diff{\mathop{}\!\mathrm{d}} \def\Xc{\mathbf{X}_c} \def\Yc{\mathbf...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.preprocessing import LabelEncoder from sklearn.cross_validation import train_test_split import seaborn as sns from itertools import combinations_with_replacement sns.set() df = pd.read_csv('TempLinkoping2016.csv') df.head() X = df.i...
github_jupyter
<!-- dom:TITLE: Data Analysis and Machine Learning: Logistic Regression --> # Data Analysis and Machine Learning: Logistic Regression <!-- dom:AUTHOR: Morten Hjorth-Jensen at Department of Physics, University of Oslo & Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State...
github_jupyter
``` from sys import modules IN_COLAB = 'google.colab' in modules if IN_COLAB: !pip install -q ir_axioms[examples] python-terrier # Start/initialize PyTerrier. from pyterrier import started, init if not started(): init(tqdm="auto") from pyterrier.datasets import get_dataset, Dataset # Load dataset. dataset_na...
github_jupyter
# Part 2: Loading a saved model __Before starting, we recommend you enable GPU acceleration if you're running on Colab. You'll also need to upload the weights you downloaded previously using the following block and using the upload button to upload your bettercnn.weights file:__ ``` # Execute this code block to insta...
github_jupyter
# 04. Preprocessing Racing Bib Numbers (RBNR) Dataset ### Purpose: Create augmented images with annotations for the RBNR dataset, and then convert the annotations to the Darknet TXT format. ### Before Running Notebook: 1. Install the imgaug library for data augmentation. Augmentation code adapted from the imgaug doc...
github_jupyter
# T1218.009 - Signed Binary Proxy Execution: Regsvcs/Regasm Adversaries may abuse Regsvcs and Regasm to proxy execution of code through a trusted Windows utility. Regsvcs and Regasm are Windows command-line utilities that are used to register .NET [Component Object Model](https://attack.mitre.org/techniques/T1559/001) ...
github_jupyter
``` from __future__ import print_function import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms import matplotlib.pyplot as plt from torch.optim.lr_scheduler import StepLR ! pip install torchsummary from torchsummary import summar...
github_jupyter
<a href="https://colab.research.google.com/github/Kabongosalomon/Secure-and-Private-AI-Scholarship-Challenge-from-Facebook/blob/master/Part_1_Tensors_in_PyTorch_(Exercises).ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Introduction to Deep Learn...
github_jupyter
# Model 2: random forest ``` # Import libraries import numpy as np import pandas as pd import itertools from sklearn.ensemble import RandomForestClassifier from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split from sklearn import metrics from sklearn.metrics import con...
github_jupyter
# S2 Fig. Classification accuracy for training and testing on individual feature groups. ``` import numpy as np import pandas as pd import seaborn as sns import matplotlib as mpl # perhaps change this later import matplotlib.pyplot as plt import scipy.io as io import os import functions.model_reliance as mr from sklea...
github_jupyter
``` import os import numpy as np import cv2 import glob import itertools import datetime import seaborn as sns from matplotlib import pyplot as plt import matplotlib.patches as patches from sklearn.model_selection import train_test_split from shutil import copy, copyfile from keras.preprocessing.image import ImageDataG...
github_jupyter
# Simple RidgeClassifier with QuantileTransformer This Code template is for the Classification tasks using the simple RidgeClassifier and feature transformation technique QuantileTransformer in a pipeline ### Required Packages ``` !pip install imblearn import warnings import numpy as np import pandas as pd imp...
github_jupyter
# Linear Mixed Effects Models ``` %matplotlib inline import numpy as np import pandas as pd import statsmodels.api as sm import statsmodels.formula.api as smf ``` **Note**: The R code and the results in this notebook has been converted to markdown so that R is not required to build the documents. The R results in th...
github_jupyter
# This is a notebook implementing the multilingual BERT for NER classification on the DaNE dataset ``` # Loading packages ## Standard packages import os import math import pandas as pd import numpy as np ## pyTorch import torch import torch.nn.functional as F from torch import nn from torch.optim import Adam from ...
github_jupyter
# ab[x] toolkit: tutorial The ab[x] toolkit contains three primary tools: * **abstar**, which performs germline assignment and primary sequence annotation * **abutils**, which provides programming primitives and commonly used functions like clustering and alignment * **abcloud**, for launching, configuring and ma...
github_jupyter
# Feature transformation with Amazon SageMaker Processing and SparkML Typically a machine learning (ML) process consists of few steps. First, gathering data with various ETL jobs, then pre-processing the data, featurizing the dataset by incorporating standard techniques or prior knowledge, and finally training an ML m...
github_jupyter
# Data and Empirics In today's session we will start to explore how to actually work with data in an interesting way. At least, interesting to us economists. We will start by finding some data and getting it ready to work with. Then, we will look at how to do a simple linear regression, before expanding that to mult...
github_jupyter
Youtube Video Explanation : https://youtu.be/nwM9ScrFVEU **Filter Method Types** 1. Basic Filter Methods - VarianceThreshod (Remove the Constant Feature and Quasi-Constant Features) - Remove Duplicate Features 2. Correlation & Ranking Filter Methods - Pearson’s correlation coefficient - Spearman’s rank...
github_jupyter
# Dimensionality Reduction Ideally, one would not need to extract or select feature in the input data. However, reducing the dimensionality as a separate pre-processing steps may be advantageous: 1. The complexity of the algorithm depends on the number of input dimensions and size of the data. 2. If some features are...
github_jupyter
``` %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt from functools import reduce plt.style.use('ggplot') results = pd.read_csv("/Users/rob/proj/lt/gwgm/geowave-geomesa-comparative-analysis/analyze/gwgm-ca-run-results-Oct1.csv") results[results.queryName.str.contains("TRACKS-US...
github_jupyter
# Exporting data from BigQuery to Google Cloud Storage In this notebook, we export BigQuery data to GCS so that we can reuse our Keras model that was developed on CSV data. ``` !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst %pip install google-cloud-bigquery==1.25.0 ``` Please ignore any incompat...
github_jupyter
# Monitor System Bottlenecks and Profile Framework Operators using Amazon Debugger This notebook provides an introduction to interactive analysis of the data captured by SageMaker Debugger. ## Table of Contents * [1. Install and import the latest SageMaker Python SDK](#1)<br> * [1.1. Import Debugger classes for ...
github_jupyter
# Circuit Breakers with Seldon and Ambassador This notebook shows how you can deploy Seldon Deployments which can have circuit breakers via Ambassador's circuit breakers configuration. ## Setup Seldon Core Use the setup notebook to [Setup Cluster](https://docs.seldon.io/projects/seldon-core/en/latest/examples/seldon...
github_jupyter
<a href="https://colab.research.google.com/github/AfrahAlharbi/ML_Week2/blob/main/D5_ML_Week2_Project.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #### **Group Members:** * Nada Alzahrani * Abeer Alghamdi * Afrah Alharbi ``` # Import what ...
github_jupyter
Should work if you have done git clone https://github.com/desihub/LSS.git and edited the part appending to the path or just made sure you are in LSS/Sandbox ``` import sys, os, glob, time import numpy as np import matplotlib.pyplot as plt import fitsio sys.path.append('../py') #this works if you are in the Sandbox dir...
github_jupyter
# 光谱识别示例 本文件用于说明如何使用shining进行光谱识别 由于多进程原因,在jupyter中运行可能有问题,本文件以讲解使用方法为主,实际使用时请参考example1.py文件,cmd、pycharm中可以顺利运行,由于Spyder对多进程的支持问题,使用Spyder运行可能会出现某些print无法打印问题。 ``` from shiningspectrum import pretreatment from shiningspectrum import database import os import matplotlib.pyplot as plt import numpy as np from shinin...
github_jupyter
# TV Script Generation In this project, you'll generate your own [Simpsons](https://en.wikipedia.org/wiki/The_Simpsons) TV scripts using RNNs. You'll be using part of the [Simpsons dataset](https://www.kaggle.com/wcukierski/the-simpsons-by-the-data) of scripts from 27 seasons. The Neural Network you'll build will gen...
github_jupyter
``` import numpy as np import itertools import matplotlib.pyplot as plt import seaborn as sns import math from numpy import genfromtxt import matplotlib.patches as mpatches import matplotlib.pyplot as plt import os # os.environ["PATH"] += os.pathsep + '/usr/local/texlive/2019/bin/x86_64-darwin' print(os.getenv("PATH"))...
github_jupyter
# County-level earthquake risk maps Several of our natural disasters are reported at the county level, so we'd like earthquake data to be available at the county level also. What we have is a USA-wide map with contours of earthquake risk, from [this source](https://geo.nyu.edu/catalog/stanford-rm034qp5477), and a map...
github_jupyter
## Single cell RNA analysis #### This notebook follows closely the excellent kallisto/bustool tutorials of the Pachter Lab. Please cite their work. ``` import matplotlib import numpy as np import matplotlib.pyplot as plt import sys, collections, os, argparse %matplotlib inline from scipy.io import mmread import pa...
github_jupyter
``` # default_exp loops ``` # loops > This module will include some useful interaction loops for types of RL agents. It'll be updated over time. ``` #hide from nbdev import * %nbdev_export import gym import numpy as np from rl_bolts import buffers, env_wrappers, neuralnets import torch import torch.nn as nn import t...
github_jupyter
# 8 CLASSES AND OBJECT-ORIENTED PROGRAMMING We now turn our attention to our major topic related to programming in Python: **using `classes` to organize programs around modules and data abstractions** in the context of **object-oriented programming.** The key to <b>object-oriented programming</b> is thinking about <...
github_jupyter
``` # Copyright 2021 Google LLC # Use of this source code is governed by an MIT-style # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. # Notebook authors: Kevin P. Murphy (murphyk@gmail.com) # and Mahmoud Soliman (mjs@aucegypt.edu) # This notebook reproduces figures for chap...
github_jupyter
``` # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load in import numpy as np # linear algebra import pandas as pd # data processing, CSV file...
github_jupyter
# Prediction of Porosity with SVM ``` # If you have installation questions, please reach out import pandas as pd # data storage import numpy as np # math and stuff import sklearn import datetime from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error from sklearn.model_...
github_jupyter
# Import Libraries ``` import sys import pandas as pd import numpy as np from sklearn import preprocessing from sklearn.decomposition import PCA from sklearn import random_projection from sklearn.preprocessing import StandardScaler from sklearn.metrics import fbeta_score, roc_curve, auc from sklearn import svm from s...
github_jupyter
# Logistic Regression with a Neural Network mindset Welcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and will also hone your intuitions about deep learning. *...
github_jupyter
# demo.ipynb 基于完整的历史数据,获得低比例饰品池的较优筛选规则 输入:饰品的 `buff_meta` 字段 输出:是否将饰品加入池中 (True / False) ## 读取数据集 ``` import os, json from tqdm import tqdm import pandas as pd import numpy as np dataset = [] for index in tqdm(range(20)): with open('data_{}.json'.format(index), 'r', encoding='utf-8') as f: dataset.ex...
github_jupyter
``` import panel as pn pn.extension() ``` The ``FileDownload`` widget allows downloading a file on the frontend by sending the file data to the browser either on initialization (if ``embed=True``) or when the button is clicked. For more information about listening to widget events and laying out widgets refer to the ...
github_jupyter
# <center>MobileNet - Pytorch # Step 1: Prepare data ``` # MobileNet-Pytorch import argparse import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim.lr_scheduler import StepLR from torchvision import datasets, transforms from torch.autograd i...
github_jupyter
``` import pandas as pd import numpy as np import logging isTest = False N = '200' dataType = 'best' pathTrain = "data/BEST&MOST" + N + "/train-" + dataType + N + ".arff" pathDev = "data/BEST&MOST" + N + "/dev-" + dataType + N + ".arff" pathTest = "data/BEST&MOST" + N + "/test-" + dataType + N + ".arff" txtPath = "m...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import warnings import random def seed_everything(seed=2020): random.seed(seed) np.random.seed(seed) seed_everything(42) warnings.filterwarnings("ignore") %matplotlib inline data = pd.read_csv("../../data/plasmaetc...
github_jupyter
# Load & save dataset features - Load the metadata of the FMA dataset - Keep only tracks of specified genres - Keep only tracks with top popularity - Create the adjacency matrix - Keep the biggest connected component if not fully connected ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt imp...
github_jupyter
# RidgeRegression with Quantile Transformer This code template is for the regression analysis using Ridge Regression and feature rescaling technique called Quantile Transformer ### Required Packages ``` import warnings import numpy as np import pandas as pd import seaborn as se import matplotlib.pyplot as plt fr...
github_jupyter
``` !pip install torch import torch print(torch.__version__) !pip install gym pyvirtualdisplay > /dev/null 2>&1 !apt-get install -y xvfb python-opengl ffmpeg > /dev/null 2>&1 !apt-get update && apt-get install -y cmake libopenmpi-dev python3-dev zlib1g-dev !apt-get install -y libxrender-dev import gym print(gym.__ve...
github_jupyter
``` import os from astropy.io import fits from astropy.wcs import WCS from astropy.modeling import models, fitting import numpy as np from scipy import optimize from matplotlib import pyplot as plt %matplotlib inline #%matplotlib notebook import aplpy ``` <h2> Open data file ``` home = os.path.expanduser("~") fitsdi...
github_jupyter
# Tutorial 1: Basics about Jupyter Notebooks You only need to look at this tutorial if you are new to Jupyter Notebooks. This page (and its file, `01_notebook_basics.ipynb`) is termed a *notebook*. Each notebook when opened in Jupyter, is a Python main module that can do anything a normal Python module can do. Specif...
github_jupyter
# Travelling Salesman Problem (TSP) If we have a list of city and distance between cities, travelling salesman problem is to find out the least sum of the distance visiting all the cities only once. <img src="https://user-images.githubusercontent.com/5043340/45661145-2f8a7a80-bb37-11e8-99d1-42368906cfff.png" width="4...
github_jupyter
<a href="https://colab.research.google.com/github/joaochenriques/MCTE_2022/blob/main/ChannelFlows/HystogramsPowerProduction/HeierTurbineModel.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 mpl impo...
github_jupyter
# Autoname Problem: 1. In GDS different cells must have different names. Relying on the incrementals naming convention can be dangerous when you merge masks that have different cells build at different run times or if you Klayout for merging masks. 2. In GDS two cells cannot have the same name. Solution: The decorat...
github_jupyter
``` import os import numpy as np import copy import time import matplotlib.pyplot as plt import scipy.stats as st %matplotlib inline import seaborn as sns sns.set(style="ticks") from curbside_models import * ``` ## Initialization ``` Q = 3 # Maximum number of spaces at each candidate location B = 200000 # ($) budge...
github_jupyter
# Character Classification This notebook contains all steps of OCR ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import tensorflow as tf import cv2 # Import Widgets from ipywidgets import Button, Text, IntSlider, interact from IPython.display import display, clear_output # Import costume...
github_jupyter
# Lists and Loops This notebook is based on materials kindly provided by the [IN1900]( https://www.uio.no/studier/emner/matnat/ifi/IN1900/h19/) team. ## Lists Python lists can contain `int`, `float`, `String` and other items. We make a list by placing the items in square brackets, `[]`, separated by commas. ``` my_...
github_jupyter
--- # Introduction to Matplotlib --- # 1. Matplotlib in the Wild A powerful plotting library that can generate a [wide range of plot types](https://matplotlib.org/stable/tutorials/introductory/sample_plots.html#sphx-glr-tutorials-introductory-sample-plots-py). In this tutorial, we focus only on x/y plots. ## 1.1 ...
github_jupyter
# Regulome Explorer Notebook This notebook computes association scores between numerical features (Gene expression and Somatic copy number) of a list of genes and other features available in TCGA BigQuery tables. The specific statistical tests used between the features are described in the following link: https://git...
github_jupyter
# Correlation analysis between the Cardano currency and Twitter This project consists of a correlation analysis between the Cardano currency and tweets. In order to define the positiveness of a tweet (if the course of the cardano will go up or down), we realise a sentiment analysis of each tweet using the VADER algori...
github_jupyter
<a href="https://colab.research.google.com/github/google/applied-machine-learning-intensive/blob/master/content/05_deep_learning/01_recurrent_neural_networks/colab.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #### Copyright 2020 Google LLC. ``` ...
github_jupyter
## Basic training functionality ``` from fastai.basic_train import * from fastai.gen_doc.nbdoc import * from fastai.vision import * from fastai.distributed import * ``` [`basic_train`](/basic_train.html#basic_train) wraps together the data (in a [`DataBunch`](/basic_data.html#DataBunch) object) with a PyTorch model t...
github_jupyter
# Fully-Connected Neural Nets In the previous homework you implemented a fully-connected two-layer neural network on CIFAR-10. The implementation was simple but not very modular since the loss and gradient were computed in a single monolithic function. This is manageable for a simple two-layer network, but would become...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '1' import re dimension = 400 vocab = "EOS abcdefghijklmnopqrstuvwxyz'" char2idx = {char: idx for idx, char in enumerate(vocab)} idx2char = {idx: char for idx, char in enumerate(vocab)} def text2idx(text): text = re.sub(r'[^a-z ]', '', text.lower()).strip() c...
github_jupyter