text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
Author: Mikael Koli email: koli.mikael@gmail.com Date: 19.01.2019 State: Stable # Demonstration of Finnish Business Portal This file demonstrates the use of Finnish Business Portal Python API. In order to replicate the demo, please make sure you have appropriate version of Python 3 and the libraries P...
github_jupyter
# LIME (Local Interpretable Model-agnostic Explanations) The original dataset contains 1000 entries with 20 categorial/symbolic attributes prepared by Prof. Hofmann. In this dataset, each entry represents a person who takes a credit by a bank. Each person is classified as good or bad credit risks according to the set ...
github_jupyter
``` import networkx as nx import pandas as pd import seaborn as sns import numpy as np cmap = sns.cm.rocket_r import matplotlib.pyplot as plt import pandas as pd from collections import defaultdict import matplotlib.patches as patches %matplotlib inline G = nx.read_gpickle('../../data/processed/SP_multiGraph_Job_Edu...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from eigenwell.src.eigen_guide import * from eigenwell.src.constants import * from eigenwell.src.structure import * import scipy.sparse.linalg as la import os L0 = 1e-6; omega_p = 0.72*np.pi*1e15; gamma = 5.5e12; ``` ## Example of a Dispersive Eigensolver We're us...
github_jupyter
# Risk averse Bayesian optimization with environmental variables This notebook considers risk averse Bayesian optimization of objectives $f(x, w)$, where $x$ denotes the design variable and $w$ denotes the environmental variable. The design variable $x$ is fully controlled by the practitioner, however, the environmen...
github_jupyter
<div class="alert alert-success" data-title=""> <h2><i class="fa fa-tasks" aria-hidden="true"></i> Fashion-MNIST </h2> </div> ``` # import import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow import keras # import keras print(tf.__version__) ``` <img src= https://leejun...
github_jupyter
Python Club for Physicists # Python básico para físicos ## Lista de ejercicios ### Problema [1](https://codeforces.com/problemset/problem/4/A): **Sandía** Un caluroso día de verano, Pete y su amigo Billy decidieron comprar una sandía. Eligieron el más grande y maduro, en su opinión. Después de eso, se pesó la sandí...
github_jupyter
``` import os import sys import numpy as np import pygfunction as gt from math import exp, log import matplotlib.pyplot as plt %matplotlib inline plt.style.use('seaborn-bright') plt.rcParams['figure.figsize'] = [15, 9] plt.rcParams['font.size'] = 12 ``` ![Field A-B](Field-A-B.PNG) ``` B = 5 D = 1 H = 100 r_b = 0.05...
github_jupyter
``` # 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 applicable law or agreed to in writi...
github_jupyter
``` %matplotlib inline %load_ext autoreload %autoreload 2 import ipywidgets as widgets from IPython.display import display ``` #### Note that beyond the basic example most of this notebook is just reference ## Basic Example Since button clicks are stateless, they are transmitted from the front-end to the back-end us...
github_jupyter
``` import ipytest import ipytest.magics import pytest from tests.src.data.test_dbpedia_utils import expected_harvard_university_data from tests.src.data.test_dbpedia_utils import expected_institute_for_quantum_computing_data from tests.src.data.test_dbpedia_utils import expected_multiple_country_url_data from tests.s...
github_jupyter
``` words = 'His e-mail is q-lar@freecodecamp.org' pieces = words.split() parts = pieces[3].split('-') n = parts[1] print(n) ``` ## Dictionary A bag of values, eaach with its own label ## List a liena collection of vvalues that stay in order ``` #dictionaries purse = dict() purse['money'] = 12 purse['candy'] = 3 pur...
github_jupyter
# Problem set 6: Classification ## Description Explore different algorithms to classify Old Bailey cases as involving "stealing" or "other." ## Imports and setup ``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt import os import seaborn as sns from sklearn.decomposition import TruncatedSVD...
github_jupyter
# Classification Shap ``` from BorutaShap import BorutaShap, load_data X, y = load_data(data_type='classification') X.head() # no model selected default is Random Forest, if classification is False it is a Regression problem Feature_Selector = BorutaShap(importance_measure='shap', classi...
github_jupyter
##### Copyright &copy; 2018 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 ...
github_jupyter
# Persistence of change Here we adopt a very simple strategy to assess whether changes persist across an author's career. We consider the sequence of books an author has written across their career, considering only books published in different years (duplicates in the same year are dropped). Then we create many "tri...
github_jupyter
``` import numpy as np import pandas as pd import torch import torchvision from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from matplotlib import pyplot as plt %matplotlib inline ``` # Create ...
github_jupyter
``` import requests endpoint = "http://graphdb:7200/repositories/data/statements" def addMapping(localTerm, targetClass, superClass, dataType): query = """ PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX xsd: <http://www.w3.org...
github_jupyter
<a href="https://colab.research.google.com/github/tensorflow/tpu/blob/master/tools/colab/shakespeare_with_tpu_and_keras.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ##### Copyright 2018 The TensorFlow Hub Authors. Licensed under the Apache Licen...
github_jupyter
``` import numpy as np import os import matplotlib.pyplot as plt import matplotlib.animation as animation import cv2 from tqdm import tqdm import random # %matplotlib inline from keras.models import Model from keras.layers import * from keras.optimizers import * from keras.callbacks import * from keras import backend ...
github_jupyter
# Introduction to Data Science - Lecture 2 - Version Control *COMP 5360 / MATH 4100, University of Utah, http://datasciencecourse.net/* In this lecture, we will learn about version control. We'll look at a couple of general principles and then go into the specifics of git and also GitHub. We'll also look at features o...
github_jupyter
# SLSTR spatial plotting, quality control and data interrogation Version: 2.0 Date: 10/04/2019 Author: Ben Loveday and Hayley Evers-King (Plymouth Marine Laboratory) Credit: This code was developed for EUMETSAT under contracts for the Copernicus programme. License: This code is o...
github_jupyter
# MEGI001-2101033 Introduction to Earth System Data ## Task 6.2 - Data Handling Analysis (2-D) Created on: Jan 24, 2019 by Ralph Florent <r.florent@jacobs-university.de> ## T6.2 change histogram bin * please produce histograms of the above topography over Europe using different bins. * Considering that the resoluti...
github_jupyter
# Create Simulated Data Set from Kinetic Model This notebook currently creates a simulated limonene data set for use in the KineticLearning.ipynb file. This file can be time consuming to run. ## 1. Setup & Import Set Parameters for Creation of Simulated DataSet ``` # Set Parameters kinetic_name = 'Full' # C...
github_jupyter
# Flopy MODFLOW Boundary Conditions Flopy has a new way to enter boundary conditions for some MODFLOW packages. These changes are substantial. Boundary conditions can now be entered as a list of boundaries, as a numpy recarray, or as a dictionary. These different styles are described in this notebook. Flopy also n...
github_jupyter
``` # Only execute if you haven't already. Make sure to restart the kernel if these libraries have not been previously installed. !pip install xgboost==0.82 --user !pip install scikit-learn==0.20.4 --user ``` **Note**: You may need to restart the kernel to use updated packages. # Import Python packages Execute the c...
github_jupyter
``` import os import numpy as np import matplotlib.pyplot as plt %matplotlib inline import tools reload(tools) from tools import * source = "/home/walterms/mcmd/nn/data/unlbl/" fnames = sorted([source+f for f in os.listdir(source)]) foutdir = "/home/walterms/mcmd/nn/data/pca/" run = "nbrs_e3" newnames = [] for f in f...
github_jupyter
# Regression Week 4: Ridge Regression (gradient descent) In this notebook, you will implement ridge regression via gradient descent. You will: * Convert an SFrame into a Numpy array * Write a Numpy function to compute the derivative of the regression weights with respect to a single feature * Write gradient descent fu...
github_jupyter
# Materials API - Exercise 2: Using the MPRester and Pymatgen to Find Materials With Exotic Mechanical Properties The tetragonal SiO$_2$ polymorph $\alpha$-cristobalite is one of the very few crystalline materials known to have a negative average Poisson's ratio, which means that its cross-section expands under tensil...
github_jupyter
___ <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> ___ # NumPy Exercises Now that we've learned about NumPy let's test your knowledge. We'll start off with a few simple tasks, and then you'll be asked some more complicated questions. ## Jennifer Yoon worked exercises, Udemy.com Py...
github_jupyter
# Creation of a contact sequence In this second notebook, we will manually create a contact sequence from a predefined gait. Then, we will add some centroidal data to the contact sequence and export it. ## Contact plan In this section we will create a contact sequence for a bipedal robot, with a gait alterning doub...
github_jupyter
# LAB 2: AutoML Tables Babyweight Training. **Learning Objectives** 1. Setup AutoML Tables 1. Create and import AutoML Tables dataset from BigQuery 1. Analyze AutoML Tables dataset 1. Train AutoML Tables model 1. Check evaluation metrics 1. Deploy model 1. Make batch predictions 1. Make online predictions ## Intro...
github_jupyter
# Using a single Table vs EArray + Table The PyTables community keep asking what can be considered a FAQ. Namely, should I use a single Table for storing my data, or should I split it in a Table and an Array? Although there is not a totally general answer, the study below address this for the common case where one h...
github_jupyter
# [DLPA17] [Deep Learning: A Practitioner's Approach](https://www.amazon.com/Deep-Learning-Practitioners-Josh-Patterson/dp/1491914254) * Practical; good intro to ML theory * Not *really* NN specific; if you understand one classifier deeply, it's easier to pick up others # [ML97] [Machine Learning](https://www.amazon....
github_jupyter
``` from rdkit import Chem from rdkit.Chem import Draw from rdkit.Chem.Draw import IPythonConsole import chembl_structure_pipeline import rdkit print(rdkit.__version__) print(chembl_structure_pipeline.__version__) import gzip with gzip.open('/home/glandrum/T5/Data/Pubchem/Substance_000000001_000500000.sdf.gz') as inf: ...
github_jupyter
``` !pip install -U tensorflow import tensorflow as tf print(tf.__version__) import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow import keras def plot_series(time, series, format="-", start=0, end=None): plt.plot(time[start:end], series[start:end], format) plt.xlabel("Tim...
github_jupyter
In this notebook we investigate the effect of normalization on the fitting procedure. ``` # General imports import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from deepmod_l1.diff_library import theta_analytical #Plotting imports import matplotlib.pyplot as plt import seaborn as sns...
github_jupyter
# Load Data and visualization ``` import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from torchvision import transforms import h5py import copy import time # print(torch.__version__) file_name = "../data/CIFAR10.hdf5" da...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Process-Data" data-toc-modified-id="Process-Data-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Process Data</a></span></li><li><span><a href="#Pre-Process-Data-For-Deep-Learning" data-toc-modified-id="P...
github_jupyter
# Chapter 9 - Data Science ## Data Preparation ## 0 - Setting up the notebook ``` import json import random from datetime import date, timedelta import faker ``` ## 1 - Preparing the Data ``` # create the faker to populate the data fake = faker.Faker() usernames = set() usernames_no = 1000 # populate the set with...
github_jupyter
# Inspecting training data ## Background Prior to training a machine learning classifier, it can be useful to understand which of our feature layers are most useful for distinguishing between classes. The feature layers the model is trained on form the **knowledge base** of the algorithm. We can explore this knowled...
github_jupyter
## Coach Instructions This Python notebook can be used before the Hack to prepare data files for the participants. The intent is for the coach to get the latest Open Powerlitfing data from their website (linked in the challenge files). In order to suport the challenge structure of implementing an inital load followe...
github_jupyter
# Local Image Classification Training - Bars Classifies the bars to extract the bits they represent. ``` BARS_FOLDER = "../bars/" TRAIN_FOLDER = "../bars/train/" TEST_FOLDER = "../bars/test/" AUGMENT_FOLDER = "../bars/augmented/" PARTITION_SCRIPT = "../tensorflow/scripts/preprocessing/partition_dataset.py" import pan...
github_jupyter
# Pandana network accessibility simple demo This notebook uses [pandana](https://udst.github.io/pandana/network.html) (v0.2) to download street network and points-of-interest data from OpenStreetMap and then calculate network accessibility to the points of interest. Note: pandana currently only runs on Python 2. Fo...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.read_csv(r'C:\Users\chosun\Desktop\AN\taxi\train.csv',nrows=2_000_000, usecols=[1,2,3,4,5,6,7]) df['pickup_datetime'] = df['pickup_datetime'].str.slice(0, 16) df['pickup_datetime'] = pd.to_datetime(df['pickup_datetime'], utc=True, format...
github_jupyter
# Motivation ## Why computer modelling? Because it is **cheaper** than real-life experiment, or in the case when real-life experiment **is not possible**. ## Typical steps of computer modelling 1. Formulate the mathematical problem as an **equation** for some **quantities** 2. Replace the continious problem by a d...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline from scipy.stats.stats import pearsonr #from scipy.stats import linregress sns.set_style('darkgrid') import os ``` ### What is Regression? Regression is a statistical method used to draw the relation be...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Image/rename_bands.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank" href="htt...
github_jupyter
``` import cluster import random, pylab, numpy class Patient(cluster.Example): pass def scaleAttrs(vals): vals = pylab.array(vals) mean = sum(vals)/len(vals) sd = numpy.std(vals) vals = vals - mean return vals/sd def getData(toScale = False): #read in data hrList, stElevList, ageList, pr...
github_jupyter
##### Copyright 2018 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 ``` import numpy as np import pandas as pd np.random.seed(12345) import matplotlib.pyplot as plt plt.rc('figure', figsize=(10, 6)) PREVIOUS_MAX_ROWS = pd.options.display.max_rows pd.options.display.max_rows = 20 np.set_printoptions(precision=4, suppress=True) ``` ## Date and Time Data Types and Tools `...
github_jupyter
## Activity 3: Analyzing Airbnb Data with geoplotlib In this last activity for geoplotlib, we will use airbnb listing data to determine the most expensive and best rated regions of accomodations in the New York area. We will write a custom layer with which we can switch between the price and the review score of eac...
github_jupyter
<hr> # PREDICTING THE STOCK MARKET WITH WATSON ## Part I: Introduction In this Jupyter Notebook you will learn step-by-step how to extract financial data from one of the most popular public databases for econometric data, as well as the cleansing and preparation processes of the data science traditional workflow. A...
github_jupyter
# PyTorch를 이용한 딥러닝 기존의 머신러닝은 통계 방법을 사용하여 특징(feature)과 라벨(label) 사이의 관계를 결정하는 데에 의존하면서 예측 모델을 만드는 데 매우 효과적일 수 있습니다. 하지만 엄청난 데이터 가용성의 증가는 그것을 처리하는 데 필요한 컴퓨팅 기술의 발전과 결합되어 인간의 뇌가 인공 신경망이라고 불리는 구조에서 정보를 처리하는 방식을 모방하여 새로운 머신러닝 기술의 출현으로 이어졌습니다. PyTorch는 깊은 신경망(deep neural networks, DNN)을 포함한 머신러닝 모델을 만들기 위한 프레임워크입니다. 이 예에서는...
github_jupyter
# CLI Record Linkage CSV Generation ## Boilerplate ``` %load_ext autoreload %autoreload 2 from importlib import reload import logging reload(logging) logging.basicConfig(format='%(asctime)s %(levelname)s:%(message)s', level=logging.INFO, datefmt='%H:%M:%S') import sys sys.path.insert(0, '../..') random_seed = 42 ```...
github_jupyter
``` # The line below sets the environment # variable CUDA_VISIBLE_DEVICES get_ipython().magic('env CUDA_VISIBLE_DEVICES = ') import numpy as np import pandas as pd import matplotlib.pyplot as plt import multiprocessing as mp # will come in handy due to the size of the data import os.path import random import time...
github_jupyter
# LM算法 (Levenberg-Marquardt algorithm) ``` #@title LM算法 { display-mode: "both" } # 本程序实现通过 Levenberg-Marquardt 算法寻找 Rosenbrock 函数的极小值点 # 可选 Rosenbrock 函数由公式 (a-x)**2+b*(y-x**2)**2 决定,代码内设置: a=1., b=1. # 在未知最优值的情况下,初始 lam 应设置较小,LM算法接近牛顿法,收敛加速,但在最优值附近会出现震荡 # coding: utf-8 import numpy as np import matplotlib.pyplot as p...
github_jupyter
``` import numpy as np # This magic just sets up matplotlib's interactive mode %matplotlib inline # So you have to explicitely import the module into the namespace import matplotlib.pyplot as plt def exact_solution(x0, v0, dt, m, t): pass def ordinary_verlet(xt, xt_1, dt, m): return 2*xt - xt_1 + (dt**2)*(x...
github_jupyter
# Pandas - Data Analysis Library for Python - Part 1 Basics Original by Wes McKinney Modified by Clayton Miller (miller.clayton@arch.ethz.ch) `Pandas` is one of the most important libraries available for data analysts. It is extremely valuable when processing time-series output data ``` %matplotlib inline ...
github_jupyter
#Importing the dataset from my google drive and converting it in numpy array. ``` import h5py import numpy as np # loading ecg data with h5py.File('/content/drive/My Drive/data/ecg_tracings.hdf5', "r") as f: x = np.array(f['tracings']) ``` #Shape of the numpy array, 827 patients, 12 lead sensors used to take read...
github_jupyter
# Introduction to Gaussian Process Models Gaussian process (GP) models serve as approximations of computationally expensive (time-consuming) black-box functions. To reduce the number of times the expensive function must be queried during optimization, the GP is used to guide the sampling decisions in the parameter spac...
github_jupyter
``` !wget --no-check-certificate \ https://storage.googleapis.com/laurencemoroney-blog.appspot.com/bbc-text.csv \ -O /tmp/bbc-text.csv import csv from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences #Stopwords list from https://github....
github_jupyter
This is an introduction to the fastbt framework. Fastbt is built upon the assumption that you enter and hold all your positions for a specific time period and exit at the end of the period or when stop loss is triggered. For more information, see the philosophy and the rationale pages. I would take a top-down approa...
github_jupyter
``` import numpy as np import pandas as pd from matplotlib import pyplot as plt from tqdm import tqdm as tqdm %matplotlib inline import torch import torchvision import torchvision.transforms as transforms import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import random from torch.util...
github_jupyter
<img align="left" src="https://lever-client-logos.s3.amazonaws.com/864372b1-534c-480e-acd5-9711f850815c-1524247202159.png" width=200> <br></br> <br></br> ## *Data Science Unit 4 Sprint 3 Assignment 2* # Convolutional Neural Networks (CNNs) # Assignment - <a href="#p1">Part 1:</a> Pre-Trained Model - <a href="#p2">Pa...
github_jupyter
``` import numpy as np import pandas as pd from glob import glob import os import torch import SimpleITK as sitk from SUMNet_bn import SUMNet from torchvision import transforms import torch.nn.functional as F import cv2 from tqdm import tqdm_notebook as tq def load_itk_image(filename): itkimage = sitk.ReadImage(fil...
github_jupyter
# Customer Churn Analysis --- Customer churn or customer attrition can broadly be classified as voluntary and involuntary churn. Voluntary churn is when the customer decides to cancel the service. In contrast, involuntary churn is when the customer is impacted by some external factor(s) and then stops using the servi...
github_jupyter
## Custom Tutorial 3: Using your model In this tutorial, we demonstrate how to fit your custom model to data. The process is nearly identical to that of the default sub-module, so we will principally focus on what's different between the default and custom versions here. Refer to Default Tutorial 3 for use details. T...
github_jupyter
``` from py2neo import Graph from igraph import Graph as IGraph from pprint import pprint graph = Graph('bolt://127.0.0.1:7687', password='jojo') # 查詢台GG query = ''' match (m:Stock{code:'2330'}) return m ''' graph.run(query).data() # Concept(概念股)種類的總數 query = ''' match (n:Concept) return count(distinct(n)) ''' graph.r...
github_jupyter
# Census income classification with scikit-learn This example uses the standard <a href="https://archive.ics.uci.edu/ml/datasets/Adult">adult census income dataset</a> from the UCI machine learning data repository. We train a k-nearest neighbors classifier using sci-kit learn and then explain the predictions. ``` imp...
github_jupyter
``` import os path = os.path.abspath(os.path.join('..','..')) import sys sys.path.append(path) from reservoirpy.pvtpy import black_oil as bl import pandas as pd import numpy as np import matplotlib.pyplot as plt import pandas as pd ``` # Create a chromatography composition ``` composition = { 'mole_fraction':[0.0...
github_jupyter
# Hello! Welcome to GMT/Python. This is a Jupyter notebook. It's an interactive computing environment where you can mix text (like this), code, and figures. The notebook is organized into cells. This is a Markdown cell (double click on it to see the source) and it can contain text, hyperlinks, images, and even Latex e...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np from grid.shake import ShakeGrid from mpl_toolkits.basemap import Basemap from collections import OrderedDict from datetime import datetime import os.path ``` The Grid class hierarchy can be used for reading, writing and manipulating various kin...
github_jupyter
``` import pandas as pd import altair as alt # run scraping script to save briefings as csv %run scrape_briefings.py # import scraped csv to pandas df briefings_df = pd.read_csv('../data/all_briefings.csv') briefings_df ``` ### Checking for null values: ``` briefings_df[briefings_df['text'].isnull()] ``` Manually co...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns sns.set_style("whitegrid") plt.rcParams["figure.figsize"] = (20, 20) import os import json import nltk import numpy as np import pandas as pd from PIL import Image from scipy.spatial.distance import cdist from tqdm import tqdm_notebook as tq...
github_jupyter
``` %reload_ext autoreload %autoreload 2 %matplotlib inline import shutil import numpy as np import pandas as pd from pathlib import Path import json import torch from tqdm import tqdm import matplotlib.pyplot as plt import seaborn as sn from src.data import IFCNetNumpy from src.models.models import MeshNet from torch....
github_jupyter
#### 프로젝트 생성 ``` !scrapy startproject naver_article ``` #### items.py ``` %%writefile naver_article/naver_article/items.py import scrapy class NaverArticleItem(scrapy.Item): title = scrapy.Field() date = scrapy.Field() press = scrapy.Field() content = scrapy.Field() category = scrapy.Field() ...
github_jupyter
# Adadelta :label:`sec_adadelta` Adadelta是AdaGrad的另一种变体( :numref:`sec_adagrad`), 主要区别在于前者减少了学习率适应坐标的数量。 此外,广义上Adadelta被称为没有学习率,因为它使用变化量本身作为未来变化的校准。 Adadelta算法是在 :cite:`Zeiler.2012`中提出的。 ## Adadelta算法 简而言之,Adadelta使用两个状态变量,$\mathbf{s}_t$用于存储梯度二阶导数的漏平均值,$\Delta\mathbf{x}_t$用于存储模型本身中参数变化二阶导数的泄露平均值。请注意,为了与其他出版物和实现的兼容性,...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt ``` # 'Plateaus' and 'Dips' in case numbers as an artifact of changing policies and partially isolated subpopulations Many simulations and pulibcations have talked about the possibility of 'peaks' in various places around the world. In effect,...
github_jupyter
# Jan 31 Lecture: Java JVM, numeric data type, selection (switch), and class I determine to migrate all my materials to Jupyter notebooks. They will help when you - miss a class - fall asleep in a class - can not catch up with the class - want to run demo codes It will save my time on - uploading my c...
github_jupyter
# Implementing a new model with Jack In this tutorial, we focus on the minimal steps required to implement a new model from scratch using Jack. Please note that this tutorial has a lot of detail. It is aimed at developers who want to understand the internals of Jack. In order to implement a Jack Reader, we define t...
github_jupyter
``` #import matplotlib.pyplot as plt #import seaborn as sns import pandas as pd import numpy as np import random as rnd from sklearn.cross_validation import KFold, cross_val_score # machine learning from sklearn.linear_model import LogisticRegression from sklearn.svm import SVC, LinearSVC from sklearn.ensemble impo...
github_jupyter
### Belajar memahami data dengan melihat visualisasinya Pie Chart ``` import matplotlib.pyplot as plt rasa = ('coklat', 'strawberry', 'vanila', 'blueberry', 'taro') data = (12, 15, 3, 16, 5) plt.pie(data, labels = rasa,) plt.show() import matplotlib.pyplot as plt rasa = ('coklat', 'strawberry', 'vanila', 'blueberr...
github_jupyter
# 文本情感分析 文本情感分析是NLP(自然语言处理)领域的重要研究领域。在NLP领域,文本情感分析(Text Sentiment Analysis)是指识别一段文本中流露出的说话者的情感态度,情感态度一般使用“积极”或者“消极”表示。文本情感分析可以广泛应用于社交媒体挖掘、电商平台订单评价挖掘、电影评论分析等领域。 为了定量表示情感偏向,一般使用[0,1]之间的一个浮点数给文本打上情感标签,越接近1表示文本的情感越正向,越接近0表示情感越负向。 本实践为基于BERT的中文短句文本情感分析。 ## 数据集 数据集使用的是谭松波老师从某酒店预定网站上整理的酒店评论数据,共7000多条评论数据,5000多条正向评论,200...
github_jupyter
# Demo Notebook for "Automatic Differentiation With Higher Infinitesimals, or Computational Smooth Infinitesimal Analysis in Weil Algebra" In this Notebook, we will demonstrate the functionality of Computational Smooth Infinitesimal Analysis. Note that IHaskell emits superfluous like: ## Setup This section prepares t...
github_jupyter
``` from IPython.core.display import HTML HTML("<style>.container { width:95% !important; }</style>") ``` # Steepest descent and Newton's method ## Let us define the same function as on the previous lesson for testing ``` def f_simple(x): return (x[0] - 10.0)**2 + (x[1] + 5.0)**2+x[0]**2 ``` ## Automatic differ...
github_jupyter
# Linked List Practice Implement a linked list class. Your class should be able to: + Append data to the tail of the list and prepend to the head + Search the linked list for a value and return the node + Remove a node + Pop, which means to return the first node's value and delete the node from the list + Insert data...
github_jupyter
# Optimisation https://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html#constrained-minimization-of-multivariate-scalar-functions-minimize ## One-dimensional optimisation A necessary and sufficient condition for a local minimum of a twice differentiable function $f:\mathbf{R}\to \mathbf{R}$ $$f'(x_0) = 0, \...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns from network import Network, TargetNetwork from layer import LowPassFilter np.random.seed(seed=0) network = Network() save_dir = "saved" #network.load(save_dir) network.set_target_prediction_mode() dt = 0.1 lp_filter = Low...
github_jupyter
<a href="https://colab.research.google.com/github/archivesunleashed/notebooks/blob/master/datathon-nyc/parquet_pandas_stonewall.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Working with Archives Unleashed Parquet Derivatives In this notebook, ...
github_jupyter
#Snippets and Programs from Chapter 6: Drawing Geometric Shapes and Fractals ``` %matplotlib inline #P151: Drawing a Circle ''' Example of using matplotlib's Circle patch ''' import matplotlib.pyplot as plt def create_circle(): circle = plt.Circle((0, 0), radius = 0.5) return circle def show_shape(patch): ...
github_jupyter
<a href="https://colab.research.google.com/github/Norod/my-colab-experiments/blob/master/3D_Photo_Inpainting_args.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> **[CVPR 2020] 3D Photography using Context-aware Layered Depth Inpainting** [project w...
github_jupyter
``` envname = 'variables/loop_stim10e-16.0et6.0phvaryp1.0t0.1plNonebp0.5.pkl' # import stuff from placerg.funcs import * from placerg.objects import* from placerg.funcsrg import * from scipy.optimize import curve_fit import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib # set up notebook displayt...
github_jupyter
# **Data Visualization** ### **Agenda** 1. What is Data Visualization? 2. Why Data Visualization? 3. What is Matplotlib? 4. Types of Plots 5. Getting Started with Matplotlib 6. Adding Styles to Our Graph 6. Introduction to Seaborn 7. Seaborn vs Matplotlib 8. Installing Seaborn 9. Installing Depend...
github_jupyter
``` import numpy as np import xarray as xr import matplotlib.pyplot as plt import cartopy.crs as ccrs import pandas import numpy as np import datetime as dt import xarray as xr import numpy as np # function that does the counting logic def incrementer(current_value, previous_value, last_id): # function that doe...
github_jupyter
# Introduction to Data Science # Lecture 21: Dimensionality Reduction *COMP 5360 / MATH 4100, University of Utah, http://datasciencecourse.net/* In this lecture, we'll discuss * dimensionality reduction * Principal Component Analysis (PCA) * using PCA for visualization Recommended Reading: * G. James, D. Witten, T...
github_jupyter
``` %pylab inline import matplotlib.pyplot as plt import pickle import random from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import train_test_split from tqdm import tqdm, trange import gen_data import features X, y = pickle.load(open('dat...
github_jupyter
``` from dotenv import load_dotenv load_dotenv("readonly.env") from google.protobuf import message_factory, any_pb2 from sqlalchemy.sql import or_ from couchers.descriptor_pool import get_descriptor_pool from couchers.db import session_scope from couchers.models import APICall from couchers.utils import now from datet...
github_jupyter
# Approximate Rates pynucastro can use rate approximations for $A(\alpha,\gamma)B$ and $A(\alpha,p)X(p,\gamma)B$, combining them into a single effective rate by assuming that the protons and nucleus $X$ are in equilibrium. ``` import pynucastro as pyna import numpy as np import matplotlib.pyplot as plt from scipy.int...
github_jupyter
``` from collections import defaultdict from pathlib import Path import re import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from tensorboard.backend.event_processing.event_accumulator import EventAccumulator import toml import tqdm def logdir2df(logdir): """convert tf.events files in a log...
github_jupyter