text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` import numpy as np import matplotlib.pyplot as plt from matplotlib import rcParams import seaborn as sns %matplotlib inline rcParams['figure.figsize'] = 10, 8 sns.set_style('whitegrid') num = 50 xv = np.linspace(-500,400,num) yv = np.linspace(-500,400,num) X,Y = np.meshgrid(xv,yv) # frist X,Y a = 8.2 intervalo...
github_jupyter
``` from egocom import audio from egocom.multi_array_alignment import gaussian_kernel from egocom.transcription import async_srt_format_timestamp from scipy.io import wavfile import os import numpy as np import pandas as pd from sklearn.metrics import accuracy_score from egocom.transcription import write_subtitles def ...
github_jupyter
# Running and Plotting Coeval Cubes The aim of this tutorial is to introduce you to how `21cmFAST` does the most basic operations: producing single coeval cubes, and visually verifying them. It is a great place to get started with `21cmFAST`. ``` %matplotlib inline import matplotlib.pyplot as plt import os # We chang...
github_jupyter
# Determinant Quantum Monte Carlo ## 1 Hubbard model The Hubbard model is defined as \begin{align} \label{eq:ham} \tag{1} H &= -\sum_{ij\sigma} t_{ij} \left( \hat{c}_{i\sigma}^\dagger \hat{c}_{j\sigma} + hc \right) + \sum_{i\sigma} (\varepsilon_i - \mu) \hat{n}_{i\sigma} + U \sum_{i} \left( \hat{n}...
github_jupyter
``` import os.path from collections import Counter from glob import glob import inspect import os import pickle import sys from cltk.corpus.latin.phi5_index import PHI5_INDEX from cltk.corpus.readers import get_corpus_reader from cltk.stem.latin.j_v import JVReplacer from cltk.stem.lemma import LemmaReplacer from cltk...
github_jupyter
``` from __future__ import print_function import numpy as np np.random.seed(1337) # for reproducibility import keras from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Convolution2D, MaxPooling2D from keras.utils i...
github_jupyter
# Compute forcing for 1%CO2 data ``` import os import numpy as np import pandas as pd import matplotlib.pyplot as plt filedir1 = '/Users/hege-beatefredriksen/OneDrive - UiT Office 365/Data/CMIP5_globalaverages/Forcingpaperdata' storedata = False # store anomalies in file? storeforcingdata = False createnewfile = Fals...
github_jupyter
# Bayesian Parametric Regression Notebook version: 1.5 (Sep 24, 2019) Author: Jerónimo Arenas García (jarenas@tsc.uc3m.es) Jesús Cid-Sueiro (jesus.cid@uc3m.es) Changes: v.1.0 - First version v.1.1 - ML Model selection included v.1.2 - Some typos corrected ...
github_jupyter
# Goals ### 1. Learn to implement Resnet V2 Block (Type - 1) using monk - Monk's Keras - Monk's Pytorch - Monk's Mxnet ### 2. Use network Monk's debugger to create complex blocks ### 3. Understand how syntactically different it is to implement the same using - Traditional Keras - Traditiona...
github_jupyter
``` from misc import HP import argparse import random import time import pickle import copy import SYCLOP_env as syc from misc import * import sys import os import cv2 import argparse import tensorflow.keras as keras from keras_networks import rnn_model_102, rnn_model_multicore_201, rnn_model_multicore_202 from curric...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt ``` # 1. ## a) ``` def simetrica(A): "Verifică dacă matricea A este simetrică" return np.all(A == A.T) def pozitiv_definita(A): "Verifică dacă matricea A este pozitiv definită" for i in range(1, len(A) + 1): d_minor = np.linalg.det(A[:i...
github_jupyter
# Input data representation as 2D array of 3D blocks > An easy way to represent input data to neural networks or any other machine learning algorithm in the form of 2D array of 3D-blocks - toc: false - branch: master - badges: true - comments: true - categories: [machine learning, jupyter, graphviz] - image: images/ar...
github_jupyter
# Visualize Counts for the three classes The number of volume-wise predictions for each of the three classes can be visualized in a 2D-space (with two classes as the axes and the remained or class1-class2 as the value of the third class). Also, the percentage of volume-wise predictions can be shown in a modified pie...
github_jupyter
# Soft Computing ## Vežba 1 - Digitalna slika, computer vision, OpenCV ### OpenCV Open source biblioteka namenjena oblasti računarske vizije (eng. computer vision). Dokumentacija dostupna <a href="https://opencv.org/">ovde</a>. ### matplotlib Plotting biblioteka za programski jezik Python i njegov numerički paket ...
github_jupyter
## <center>Ensemble models from machine learning: an example of wave runup and coastal dune erosion</center> ### <center>Tomas Beuzen<sup>1</sup>, Evan B. Goldstein<sup>2</sup>, Kristen D. Splinter<sup>1</sup></center> <center><sup>1</sup>Water Research Laboratory, School of Civil and Environmental Engineering, UNSW Sy...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '' # !git pull import tensorflow as tf import malaya_speech import malaya_speech.train from malaya_speech.train.model import fastspeech2 import numpy as np _pad = 'pad' _start = 'start' _eos = 'eos' _punctuation = "!'(),.:;? " _special = '-' _letters = 'ABCDEFGHIJKLMN...
github_jupyter
# Building and using data schemas for computer vision This tutorial illustrates how to use raymon profiling to guard image quality in your production system. The image data is taken from [Kaggle](https://www.kaggle.com/ravirajsinh45/real-life-industrial-dataset-of-casting-product) and is courtesy of PILOT TECHNOCAST, S...
github_jupyter
``` pip install pandas pip install numpy pip install sklearn pip install matplotlib from sklearn import cluster from sklearn.cluster import KMeans import pandas as pd import numpy as np from matplotlib import pyplot as plt df = pd.read_csv("sample_stocks.csv") df df.describe() df.head() df.info() # x = df['returns'] # ...
github_jupyter
``` import numpy as np import sklearn import pandas as pd import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline # Load the Boston Housing Dataset from sklearn from sklearn.datasets import load_boston boston_dataset = load_boston() print(boston_dataset.keys()) print(boston_dataset.DESCR) # Create t...
github_jupyter
``` from IPython.core.display import display, HTML import pandas as pd import numpy as np import copy import os %load_ext autoreload %autoreload 2 import sys sys.path.insert(0,"/local/rankability_toolbox") PATH_TO_RANKLIB='/local/ranklib' from numpy import ix_ import numpy as np D = np.loadtxt(PATH_TO_RANKLIB+"/prob...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier from sklearn.metrics import mean_squared_error, accuracy_score, f1_score, r2_score, explained_variance_score, roc_auc_score from sklearn.preprocessing import MinMaxScale...
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
# SQLAlchemy Homework - Surfs Up! ### Before You Begin 1. Create a new repository for this project called `sqlalchemy-challenge`. **Do not add this homework to an existing repository**. 2. Clone the new repository to your computer. 3. Add your Jupyter notebook and `app.py` to this folder. These will be the main scr...
github_jupyter
# Maximum Likelihood Estimation (Generic models) This tutorial explains how to quickly implement new maximum likelihood models in `statsmodels`. We give two examples: 1. Probit model for binary dependent variables 2. Negative binomial model for count data The `GenericLikelihoodModel` class eases the process by prov...
github_jupyter
``` #Download the dataset from opensig import urllib.request urllib.request.urlretrieve('http://opendata.deepsig.io/datasets/2016.10/RML2016.10a.tar.bz2', 'RML2016.10a.tar.bz2') #decompress the .bz2 file into .tar file import sys import os import bz2 zipfile = bz2.BZ2File('./RML2016.10a.tar.bz2') # open the file data ...
github_jupyter
<a href="https://colab.research.google.com/github/lvisdd/object_detection_tutorial/blob/master/object_detection_face_detector.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` # restart (or reset) your virtual machine #!kill -9 -1 ``` # [Tensorfl...
github_jupyter
[Index](Index.ipynb) - [Next](Widget List.ipynb) # Simple Widget Introduction ## What are widgets? Widgets are eventful python objects that have a representation in the browser, often as a control like a slider, textbox, etc. ## What can they be used for? You can use widgets to build **interactive GUIs** for your ...
github_jupyter
``` import numpy as np from pandas import Series, DataFrame import pandas as pd from sklearn import preprocessing, tree from sklearn.metrics import accuracy_score # from sklearn.model_selection import train_test_split, KFold from sklearn.neighbors import KNeighborsClassifier from sklearn.cross_validation import KFold d...
github_jupyter
# `Практикум по программированию на языке Python` <br> ## `Занятие 2: Пользовательские и встроенные функции, итераторы и генераторы` <br><br> ### `Мурат Апишев (mel-lain@yandex.ru)` #### `Москва, 2021` ### `Функции range и enumerate` ``` r = range(2, 10, 3) print(type(r)) for e in r: print(e, end=' ') for ind...
github_jupyter
``` %pylab inline import re from pathlib import Path import pandas as pd import seaborn as sns datdir = Path('data') figdir = Path('plots') figdir.mkdir(exist_ok=True) mpl.rcParams.update({'figure.figsize': (2.5,1.75), 'figure.dpi': 300, 'axes.spines.right': False, 'axes.spines.top': False, ...
github_jupyter
# Running the Direct Fidelity Estimation (DFE) algorithm This example walks through the steps of running the direct fidelity estimation (DFE) algorithm as described in these two papers: * Direct Fidelity Estimation from Few Pauli Measurements (https://arxiv.org/abs/1104.4695) * Practical characterization of quantum ...
github_jupyter
# Gujarati with CLTK See how you can analyse your Gujarati texts with <b>CLTK</b> ! <br> Let's begin by adding the `USER_PATH`.. ``` import os USER_PATH = os.path.expanduser('~') ``` In order to be able to download Gujarati texts from CLTK's Github repo, we will require an importer. ``` from cltk.corpus.utils.impor...
github_jupyter
<h1>CREAZIONE MODELLO SARIMA REGIONE SARDEGNA ``` import pandas as pd df = pd.read_csv('../../csv/regioni/sardegna.csv') df.head() df['DATA'] = pd.to_datetime(df['DATA']) df.info() df=df.set_index('DATA') df.head() ``` <h3>Creazione serie storica dei decessi totali della regione Sardegna ``` ts = df.TOTALE ts.head()...
github_jupyter
# Logistic Regression on 'HEART DISEASE' Dataset Elif Cansu YILDIZ ``` from pyspark.sql import SparkSession from pyspark.sql.types import * from pyspark.sql.functions import col, countDistinct from pyspark.ml.feature import OneHotEncoderEstimator, StringIndexer, VectorAssembler, MinMaxScaler, IndexToString from pysp...
github_jupyter
# Recommending Movies: Retrieval Real-world recommender systems are often composed of two stages: 1. The retrieval stage is responsible for selecting an initial set of hundreds of candidates from all possible candidates. The main objective of this model is to efficiently weed out all candidates that the user is not i...
github_jupyter
##### Copyright 2018 The TF-Agents 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 a...
github_jupyter
``` import pandas as pd import numpy as np from tqdm import tqdm tqdm.pandas() import os, time, datetime from sklearn.model_selection import train_test_split from sklearn.metrics import roc_auc_score, f1_score, roc_curve, auc import lightgbm as lgb import xgboost as xgb def format_time(elapsed): ''' Takes a ti...
github_jupyter
# Example usage of the O-C tools ## This example shows how to construct and fit with MCMC the O-C diagram of the RR Lyrae star OGLE-BLG-RRLYR-02950 ### We start with importing some libraries ``` import numpy as np import oc_tools as octs ``` ### We read in the data, set the period used to construct the O-C diagram ...
github_jupyter
# Consensus Optimization This notebook contains the code for the toy experiment in the paper [The Numerics of GANs](https://arxiv.org/abs/1705.10461). ``` %load_ext autoreload %autoreload 2 import tensorflow as tf from tensorflow.contrib import slim import numpy as np import scipy as sp from scipy import stats from m...
github_jupyter
<a href="https://colab.research.google.com/github/bhuwanupadhyay/codes/blob/main/ipynbs/reshape_demo.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` pip install pydicom # Import tensorflow import logging import tensorflow as tf import keras.bac...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pandas as pd EXPERIMENT = 'bivariate_power' TAG = '' df = pd.read_csv(f'./results/{EXPERIMENT}_results{TAG}.csv', sep=', ', engine='python') plot_df = df x_var_rename_dict = { 'sample_size': '# Samples', 'Number of environments...
github_jupyter
# This Notebook uses a Session Event Dataset from E-Commerce Website (https://www.kaggle.com/mkechinov/ecommerce-behavior-data-from-multi-category-store and https://rees46.com/) to build an Outlier Detection based on an Autoencoder. ``` import mlflow import numpy as np import os import shutil import pandas as pd impor...
github_jupyter
<a href="https://colab.research.google.com/github/rwarnung/datacrunch-notebooks/blob/master/dcrunch_R_example.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> **Data crunch example R script** --- author: sweet-richard date: Jan 30, 2022 require...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Datasets/Terrain/srtm_mtpi.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank" h...
github_jupyter
#Introduction to Data Science See [Lesson 1](https://www.udacity.com/course/intro-to-data-analysis--ud170) You should run it in local Jupyter env as this notebook refers to local dataset ``` import unicodecsv from datetime import datetime as dt enrollments_filename = 'dataset/enrollments.csv' engagement_filename = ...
github_jupyter
``` import pandas as pd import numpy as np import keras from keras.models import Sequential,Model from keras.layers import Dense, Dropout,BatchNormalization,Input from keras.optimizers import RMSprop from keras.regularizers import l2,l1 from keras.optimizers import Adam from sklearn.model_selection import LeaveOneOut ...
github_jupyter
# 2 Dead reckoning *Dead reckoning* is a means of navigation that does not rely on external observations. Instead, a robot’s position is estimated by summing its incremental movements relative to a known starting point. Estimates of the distance traversed are usually obtained from measuring how many times the wheels ...
github_jupyter
# Computer Vision Nanodegree ## Project: Image Captioning --- In this notebook, you will use your trained model to generate captions for images in the test dataset. This notebook **will be graded**. Feel free to use the links below to navigate the notebook: - [Step 1](#step1): Get Data Loader for Test Dataset -...
github_jupyter
``` # TensorFlow pix2pix implementation from __future__ import absolute_import, division, print_function, unicode_literals try: # %tensorflow_version only exists in Colab. %tensorflow_version 2.x except Exception: pass import tensorflow as tf import os import time from matplotlib import pyplot as plt from IPyt...
github_jupyter
# Basic Workflow ``` # Always have your imports at the top import pandas as pd from sklearn.pipeline import make_pipeline from sklearn.impute import SimpleImputer from sklearn.ensemble import RandomForestClassifier from sklearn.base import TransformerMixin from hashlib import sha1 # just for grading purposes import j...
github_jupyter
# Lab 11: MLP -- exercise # Understanding the training loop ``` import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from random import randint import utils ``` ### Download the data and print the sizes ``` train_data=torch.load('../data/fashion-mnist/train_data.pt') print...
github_jupyter
## Main points * Solution should be reasonably simple because the contest is only 24 hours long * Metric is based on the prediction of clicked pictures one week ahead, so clicks are the most important information * More recent information is more important * Only pictures that were shown to a user could be clicked, so...
github_jupyter
This challenge implements an instantiation of OTR based on AES block cipher with modified version 1.0. OTR, which stands for Offset Two-Round, is a blockcipher mode of operation to realize an authenticated encryption with associated data (see [[1]](#1)). AES-OTR algorithm is a campaign of CAESAR competition, it has suc...
github_jupyter
``` import re import os import keras.backend as K import numpy as np import pandas as pd from keras import layers, models, utils import json def reset_everything(): import tensorflow as tf %reset -f in out dhist tf.reset_default_graph() K.set_session(tf.InteractiveSession()) # Constants for our networks...
github_jupyter
# AWS Marketplace Product Usage Demonstration - Algorithms ## Using Algorithm ARN with Amazon SageMaker APIs This sample notebook demonstrates two new functionalities added to Amazon SageMaker: 1. Using an Algorithm ARN to run training jobs and use that result for inference 2. Using an AWS Marketplace product ARN - w...
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 so will also hone your intuitions about deep learning....
github_jupyter
# Azure ML Training Pipeline for COVID-CXR This notebook defines an Azure machine learning pipeline for a single training run and submits the pipeline as an experiment to be run on an Azure virtual machine. ``` # Import statements import azureml.core from azureml.core import Experiment from azureml.core import Workspa...
github_jupyter
# SIT742: Modern Data Science **(Week 01: Programming Python)** --- - Materials in this module include resources collected from various open-source online repositories. - You are free to use, change and distribute this package. - If you found any issue/bug for this document, please submit an issue at [tulip-lab/sit74...
github_jupyter
# General Equilibrium This notebook illustrates **how to solve GE equilibrium models**. The example is a simple one-asset model without nominal rigidities. The notebook shows how to: 1. Solve for the **stationary equilibrium**. 2. Solve for (non-linear) **transition paths** using a relaxtion algorithm. 3. Solve for ...
github_jupyter
``` import numpy as np import scipy as sp import scipy.interpolate import matplotlib.pyplot as plt import pandas as pd import scipy.stats import scipy.optimize from scipy.optimize import curve_fit import minkowskitools as mt import importlib importlib.reload(mt) n=4000 rand_points = np.random.uniform(size=(2, n-2)) ...
github_jupyter
# Generative Adversarial Networks Throughout most of this book, we've talked about how to make predictions. In some form or another, we used deep neural networks learned mappings from data points to labels. This kind of learning is called discriminative learning, as in, we'd like to be able to discriminate between ph...
github_jupyter
*This notebook is part of course materials for CS 345: Machine Learning Foundations and Practice at Colorado State University. Original versions were created by Asa Ben-Hur. The content is availabe [on GitHub](https://github.com/asabenhur/CS345).* *The text is released under the [CC BY-SA license](https://creativecom...
github_jupyter
# Lecture 3.3: Anomaly Detection [**Lecture Slides**](https://docs.google.com/presentation/d/1_0Z5Pc5yHA8MyEBE8Fedq44a-DcNPoQM1WhJN93p-TI/edit?usp=sharing) This lecture, we are going to use gaussian distributions to detect anomalies in our emoji faces dataset **Learning goals:** - Introduce an anomaly detection pro...
github_jupyter
# Import Necessary Libraries ``` import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn import preprocessing from sklearn.ensemble import RandomForestClassifier from sklearn import svm from sklearn.metrics import precision_score, recall_score # display images from IPy...
github_jupyter
# 第8章: ニューラルネット 第6章で取り組んだニュース記事のカテゴリ分類を題材として,ニューラルネットワークでカテゴリ分類モデルを実装する.なお,この章ではPyTorch, TensorFlow, Chainerなどの機械学習プラットフォームを活用せよ. ## 70. 単語ベクトルの和による特徴量 *** 問題50で構築した学習データ,検証データ,評価データを行列・ベクトルに変換したい.例えば,学習データについて,すべての事例$x_i$の特徴ベクトル$\boldsymbol{x}_i$を並べた行列$X$と正解ラベルを並べた行列(ベクトル)$Y$を作成したい. $$ X = \begin{pmatrix} \boldsy...
github_jupyter
# Analyse a series <div class="alert alert-block alert-warning"> <b>Under construction</b> </div> ``` import os import pandas as pd from IPython.display import Image as DImage from IPython.core.display import display, HTML import series_details # Plotly helps us make pretty charts import plotly.offline as py imp...
github_jupyter
# SLU07 - Regression with Linear Regression: Example notebook # 1 - Writing linear models In this section you have a few examples on how to implement simple and multiple linear models. Let's start by implementing the following: $$y = 1.25 + 5x$$ ``` def first_linear_model(x): """ Implements y = 1.25 + 5*x ...
github_jupyter
``` #importing libraries import pandas as pd import boto3 import json import configparser from botocore.exceptions import ClientError import psycopg2 def config_parse_file(): """ Parse the dwh.cfg configuration file :return: """ global KEY, SECRET, DWH_CLUSTER_TYPE, DWH_NUM_NODES, \ DWH_NOD...
github_jupyter
# Task 4: Support Vector Machines _All credit for the code examples of this notebook goes to the book "Hands-On Machine Learning with Scikit-Learn & TensorFlow" by A. Geron. Modifications were made and text was added by K. Zoch in preparation for the hands-on sessions._ # Setup First, import a few common modules, en...
github_jupyter
# Create TensorFlow Deep Neural Network Model **Learning Objective** - Create a DNN model using the high-level Estimator API ## Introduction We'll begin by modeling our data using a Deep Neural Network. To achieve this we will use the high-level Estimator API in Tensorflow. Have a look at the various models availab...
github_jupyter
# Compare different DEMs for individual glaciers For most glaciers in the world there are several digital elevation models (DEM) which cover the respective glacier. In OGGM we have currently implemented 10 different open access DEMs to choose from. Some are regional and only available in certain areas (e.g. Greenland ...
github_jupyter
Created from https://github.com/awslabs/amazon-sagemaker-examples/blob/master/introduction_to_amazon_algorithms/random_cut_forest/random_cut_forest.ipynb ``` import boto3 import botocore import sagemaker import sys bucket = 'tdk-awsml-sagemaker-data.io-dev' # <--- specify a bucket you have access to prefix = '' ex...
github_jupyter
<br> # Analysis of Big Earth Data with Jupyter Notebooks <img src='./img/opengeohub_logo.png' alt='OpenGeoHub Logo' align='right' width='25%'></img> Lecture given for OpenGeoHub summer school 2020<br> Tuesday, 18. August 2020 | 11:00-13:00 CEST #### Lecturer * [Julia Wagemann](https://jwagemann.com) | Independent c...
github_jupyter
``` import pandas as pd import numpy as np from tools import acc_score df_train = pd.read_csv("../data/train.csv", index_col=0) df_test = pd.read_csv("../data/test.csv", index_col=0) train_bins = seq_to_num(df_train.Sequence, target_split=True, pad=True, pad_adaptive=True, pad_maxlen=100, dtype=...
github_jupyter
# 📃 Solution of Exercise M6.01 The aim of this notebook is to investigate if we can tune the hyperparameters of a bagging regressor and evaluate the gain obtained. We will load the California housing dataset and split it into a training and a testing set. ``` from sklearn.datasets import fetch_california_housing fr...
github_jupyter
## Recommendations with MovieTweetings: Collaborative Filtering One of the most popular methods for making recommendations is **collaborative filtering**. In collaborative filtering, you are using the collaboration of user-item recommendations to assist in making new recommendations. There are two main methods of ...
github_jupyter
# Figure 4: NIRCam Grism + Filter Sensitivities ($1^{st}$ order) *** ### Table of Contents 1. [Information](#Information) 2. [Imports](#Imports) 3. [Data](#Data) 4. [Generate the First Order Grism + Filter Sensitivity Plot](#Generate-the-First-Order-Grism-+-Filter-Sensitivity-Plot) 5. [Issues](#Issues) 6. [About this...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sb import gc prop_data = pd.read_csv("properties_2017.csv") # prop_data train_data = pd.read_csv("train_2017.csv") train_data # missing_val = prop_data.isnull().sum().reset_index() # missing_val.columns = ['column_name', 'missi...
github_jupyter
``` from IPython.core.display import HTML with open('../style.css', 'r') as file: css = file.read() HTML(css) ``` # A Crypto-Arithmetic Puzzle In this exercise we will solve the crypto-arithmetic puzzle shown in the picture below: <img src="send-more-money.png"> The idea is that the letters "$\texttt{S}$", "$\t...
github_jupyter
# Solution based on Multiple Models ``` import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all" ``` # Tokenize and Numerize - Make it ready ``` training_size = 20000 training_sentences = sent...
github_jupyter
# Tutorial on Python for scientific computing Marcos Duarte This tutorial is a short introduction to programming and a demonstration of the basic features of Python for scientific computing. To use Python for scientific computing we need the Python program itself with its main modules and specific packages for scient...
github_jupyter
``` import numpy as np import pandas as pd import json as json from scipy import stats from statsmodels.formula.api import ols import matplotlib.pyplot as plt from scipy.signal import savgol_filter from o_plot import opl # a small local package dedicated to this project # Prepare the data # loading the data file_name =...
github_jupyter
# **OPTICS Algorithm** Ordering Points to Identify the Clustering Structure (OPTICS) is a Clustering Algorithm which locates region of high density that are seperated from one another by regions of low density. For using this library in Python this comes under Scikit Learn Library. ## Parameters: **Reachability Dis...
github_jupyter
# Chapter 7. 텍스트 문서의 범주화 - (4) IMDB 전체 데이터로 전이학습 - 앞선 전이학습 실습과는 달리, IMDB 영화리뷰 데이터셋 전체를 사용하며 문장 수는 10개 -> 20개로 조정한다 - IMDB 영화 리뷰 데이터를 다운로드 받아 data 디렉토리에 압축 해제한다 - 다운로드 : http://ai.stanford.edu/~amaas/data/sentiment/ - 저장경로 : data/aclImdb ``` import os import config from dataloader.loader import Loader from pre...
github_jupyter
``` import pandas as pd import numpy as np data = np.array([1,2,3,4,5,6]) name = np.array(['' for x in range(6)]) besio = np.array(['' for x in range(6)]) entity = besio columns = ['name/doi', 'data', 'BESIO', 'entity'] df = pd.DataFrame(np.array([name, data, besio, entity]).transpose(), columns=columns) df.iloc[1,0] =...
github_jupyter
# CTR预估(1) 资料&&代码整理by[@寒小阳](https://blog.csdn.net/han_xiaoyang)(hanxiaoyang.ml@gmail.com) reference: * [《广告点击率预估是怎么回事?》](https://zhuanlan.zhihu.com/p/23499698) * [从ctr预估问题看看f(x)设计—DNN篇](https://zhuanlan.zhihu.com/p/28202287) * [Atomu2014 product_nets](https://github.com/Atomu2014/product-nets) 关于CTR预估的背景推荐大家看欧阳辰老师在知...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set(color_codes=True) %matplotlib inline %config InlineBackend.figure_format = 'retina' import os destdir = '/Users/argha/Dropbox/CS/DatSci/nyc-data' files = [ f for f in os.listdir(destdir) if os.path.isfile(os.path.jo...
github_jupyter
``` import os from tensorflow.keras import layers from tensorflow.keras import Model from tensorflow.keras.applications.inception_v3 import InceptionV3 #!wget --no-check-certificate \ # https://storage.googleapis.com/mledu-datasets/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 \ # -O /tmp/inception_v...
github_jupyter
CER041 - Install signed Knox certificate ======================================== This notebook installs into the Big Data Cluster the certificate signed using: - [CER031 - Sign Knox certificate with generated CA](../cert-management/cer031-sign-knox-generated-cert.ipynb) Steps ----- ### Parameters ``` app_na...
github_jupyter
``` !pip install -q condacolab import condacolab condacolab.install() !conda install -c chembl chembl_structure_pipeline import chembl_structure_pipeline from chembl_structure_pipeline import standardizer from IPython.display import clear_output # https://www.dgl.ai/pages/start.html # !pip install dgl !pip install dg...
github_jupyter
# Normalize text ``` herod_fp = '/Users/kyle/cltk_data/greek/text/tlg/plaintext/TLG0016.txt' with open(herod_fp) as fo: herod_raw = fo.read() print(herod_raw[2000:2500]) # What do we notice needs help? from cltk.corpus.utils.formatter import tlg_plaintext_cleanup herod_clean = tlg_plaintext_cleanup(herod_raw, rm...
github_jupyter
``` import pandas as pd import numpy as np # set the column names colnames=['price', 'year_model', 'mileage', 'fuel_type', 'mark', 'model', 'fiscal_power', 'sector', 'type', 'city'] # read the csv file as a dataframe df = pd.read_csv("./data/output.csv", sep=",", names=colnames, header=None) # let's get some simple vi...
github_jupyter
``` import glob import os import random import numpy as np import pandas as pd import matplotlib.pyplot as plt import cv2 import math from tqdm.auto import tqdm from sklearn import linear_model import optuna import seaborn as sns FEAT_OOFS = [ { 'model' : 'feat_lasso', 'fn' : '../output/2021011_se...
github_jupyter
``` #import necessary modules, set up the plotting import numpy as np %matplotlib inline %config InlineBackend.figure_format = 'svg' import matplotlib;matplotlib.rcParams['figure.figsize'] = (8,6) from matplotlib import pyplot as plt import GPy ``` # Interacting with models ### November 2014, by Max Zwiessele #### wi...
github_jupyter
``` %matplotlib inline ``` # Partial Dependence Plots Sigurd Carlsen Feb 2019 Holger Nahrstaedt 2020 .. currentmodule:: skopt Plot objective now supports optional use of partial dependence as well as different methods of defining parameter values for dependency plots. ``` print(__doc__) import sys from skopt.plot...
github_jupyter
``` %load_ext autoreload %autoreload 2 import tensorflow as tf import numpy as np import pandas as pd import altair as alt import shap from interaction_effects.marginal import MarginalExplainer from interaction_effects import utils n = 3000 d = 3 batch_size = 50 learning_rate = 0.02 X = np.random.randn(n, d) y = (np.s...
github_jupyter
### Prepare stimuli in stereo with sync tone in the L channel To syncrhonize the recording systems, each stimulus file goes in stereo, the L channel has the stimulus, and the R channel has a pure tone (500-5Khz). This is done here, with the help of the rigmq.util.stimprep module It uses (or creates) a dictionary of {st...
github_jupyter
# Scaling and Normalization ``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.preprocessing import StandardScaler, MinMaxScaler, RobustScaler from scipy.cluster.vq import whiten ``` Terminology (from [this post](https://towardsdatascience.com/scale-standardi...
github_jupyter
# Tutorial 6.3. Advanced Topics on Extreme Value Analysis ### Description: Some advanced topics on Extreme Value Analysis are presented. #### Students are advised to complete the exercises. Project: Structural Wind Engineering WS19-20 Chair of Structural Analysis @ TUM - R. Wüchner, M. Péntek Autho...
github_jupyter
``` # Load necessary modules and libraries from sklearn.preprocessing import StandardScaler from sklearn.linear_model import Perceptron from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score from sklearn.model_selection import learning_curve from sklearn.neural_network import M...
github_jupyter