text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Лекция 7. Разреженные матрицы и прямые методы для решения больших разреженных систем ## План на сегодняшнюю лекцию - Плотные неструктурированные матрицы и распределённое хранение - Разреженные матрицы и форматы их представления - Быстрая реализация умножения разреженной матрицы на вектор - Метод Гаусса для разреже...
github_jupyter
# The stereology module The main purpose of stereology is to extract quantitative information from microscope images relating two-dimensional measures obtained on sections to three-dimensional parameters defining the structure. The aim of stereology is not to reconstruct the 3D geometry of the material (as in tomograp...
github_jupyter
# Convolutional Neural Network ### Author: Ivan Bongiorni, Data Scientist at GfK. [LinkedIn profile](https://www.linkedin.com/in/ivan-bongiorni-b8a583164/) In this Notebook I will implement a **basic CNN in TensorFlow 2.0**. I will use the famous **Fashion MNIST** dataset, [published by Zalando](https://github.com/z...
github_jupyter
# quant-econ Solutions: Modeling Career Choice Solutions for http://quant-econ.net/py/career.html ``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt from quantecon import DiscreteRV, compute_fixed_point from career import CareerWorkerProblem ``` ## Exercise 1 Simulate job / career paths. ...
github_jupyter
# Regularization Welcome to the second assignment of this week. Deep Learning models have so much flexibility and capacity that **overfitting can be a serious problem**, if the training dataset is not big enough. Sure it does well on the training set, but the learned network **doesn't generalize to new examples** that...
github_jupyter
# Table of Contents * [1c. Fixed flux spinodal decomposition on a T shaped domain](#1c.-Fixed-flux-spinodal-decomposition-on-a-T-shaped-domain) * [Use Binder For Live Examples](#Use-Binder-For-Live-Examples) * [Define $f_0$](#Define-$f_0$) * [Define the Equation](#Define-the-Equation) * [Solve the Equation](#Solve-...
github_jupyter
# IMPORTS ``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt ``` # READ THE DATA ``` data = pd.read_csv('./input/laptops.csv', encoding='latin-1') data.head(10) ``` # MAIN EDA BLOCK ``` print(f'Data Shape\nRows: {data.shape[0]}\nColumns: {data.shape[1]}') print('=' *...
github_jupyter
# Visualizing invasive and non-invasive EEG data [Liberty Hamilton, PhD](https://csd.utexas.edu/research/hamilton-lab) Assistant Professor, University of Texas at Austin Department of Speech, Language, and Hearing Sciences and Department of Neurology, Dell Medical School Welcome! In this notebook we will be discussi...
github_jupyter
# MDN-transformer with examples - What kind of data can be predicted by a mixture density network Transformer? - Continuous sequential data - Drawing data and RoboJam Touch Screem would be good examples for this, continuous values yield high resolution in 2d space. # 1. Kanji Generation - Firstly, let's try mode...
github_jupyter
### Imports ``` import pandas as pd import numpy as np #Python Standard Libs Imports import json import urllib2 import sys from datetime import datetime from os.path import isfile, join, splitext from glob import glob #Imports to enable visualizations import seaborn as sns import matplotlib.pyplot as plt %matplotlib...
github_jupyter
``` import os import h5py import numpy as np # -- local -- from feasibgs import util as UT from feasibgs import catalogs as Cat from feasibgs import forwardmodel as FM import matplotlib as mpl import matplotlib.pyplot as pl mpl.rcParams['text.usetex'] = True mpl.rcParams['font.family'] = 'serif' mpl.rcParams['axes...
github_jupyter
# Multi-Layer Perceptron, MNIST --- In this notebook, we will train an MLP to classify images from the [MNIST database](http://yann.lecun.com/exdb/mnist/) hand-written digit database. The process will be broken down into the following steps: >1. Load and visualize the data 2. Define a neural network 3. Train the model...
github_jupyter
``` import pandas as pd import os import s3fs # for reading from S3FileSystem import json %matplotlib inline import matplotlib.pyplot as plt import torch.nn as nn import torch import torch.utils.model_zoo as model_zoo import numpy as np import torchvision.models as models # To get ResNet18 # From - https://github....
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') path = '/content/drive/MyDrive/Research/AAAI/dataset1/second_layer_without_entropy/' 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 ...
github_jupyter
``` class Solution: def numberOfSubstrings(self, s: str) -> int: letters = {'a', 'b', 'c'} N = len(s) count = 0 for gap in range(3, N + 1): for start in range(N - gap + 1): sub_str = s[start:start + gap] if set(sub_str) == letters:...
github_jupyter
# Parse Java Methods ---- (C) Maxim Gansert, 2020, Mindscan Engineering ``` import sys sys.path.insert(0,'../src') import os import datetime from com.github.c2nes.javalang import tokenizer, parser, ast from de.mindscan.fluentgenesis.dataprocessing.method_extractor import tokenize_file, extract_allmethods_from_compila...
github_jupyter
``` %matplotlib inline from matplotlib import pyplot as plt plt.rcParams['figure.figsize'] = (10, 8) import seaborn as sns import numpy as np import pandas as pd from sklearn.preprocessing import LabelEncoder import collections from sklearn.model_selection import GridSearchCV from sklearn import preprocessing from skle...
github_jupyter
The first thing we need to do is to download the dataset from Kaggle. We use the [Enron dataset](https://www.kaggle.com/wcukierski/enron-email-dataset), which is the biggest public email dataset available. To do so we will use GDrive and download the dataset within a Drive folder to be used by Colab. ``` from google.c...
github_jupyter
## 1. The brief <p>Imagine working for a digital marketing agency, and the agency is approached by a massive online retailer of furniture. They want to test our skills at creating large campaigns for all of their website. We are tasked with creating a prototype set of keywords for search campaigns for their sofas secti...
github_jupyter
# LSTM - Long Short Term Memory - From [v1] Lecture 60 - LSTM, another variation of RNN ## Study Links - [An empirical exploration of recurrent network architectures](https://dl.acm.org/citation.cfm?id=3045367) - https://dblp.uni-trier.de/db/journals/corr/corr1506.html - [A Critical Review of Recurrent Neural ...
github_jupyter
# US Treasury Interest Rates / Yield Curve Data --- A look at the US Treasury yield curve, according to interest rates published by the US Treasury. ``` import pandas as pd import altair as alt import numpy as np url = 'https://www.treasury.gov/resource-center/data-chart-center/interest-rates/pages/TextView.aspx?dat...
github_jupyter
This notebook is part of the $\omega radlib$ documentation: https://docs.wradlib.org. Copyright (c) $\omega radlib$ developers. Distributed under the MIT License. See LICENSE.txt for more info. # Supported radar data formats The binary encoding of many radar products is a major obstacle for many potential radar user...
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
# Exercices With each exercice will teach you one aspect of deep learning. The process of machine learning can be decompose in 7 steps : * Data preparation * Model definition * Model training * Model evaluation * Hyperparameter tuning * Prediction ## 3 - Model training - 3.1 Metrics : evaluate model - 3.2 Loss funct...
github_jupyter
``` %run setup.ipynb from scipy.stats import dirichlet import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline import traceback import logging logger = logging.getLogger('ag1000g-phase2') logger.setLevel(logging.DEBUG) # create console handler with a higher log level ch = logging.StreamHandler() ch.s...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/FeatureCollection/column_statistics_by_group.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a ...
github_jupyter
# <div align="center">BERT (Bidirectional Encoder Representations from Transformers) Explained: State of the art language model for NLP</div> --------------------------------------------------------------------- <img src='asset/9_6/main.png'> you can Find me on Github: > ###### [ GitHub](https://github.com/lev1khacha...
github_jupyter
# Real World Example: ### AI, Machine Learning & Data Science --- # What is the Value for your Business? - By seeing acutal examples you'll be empowered to ask the right questions (and get fair help from consultants, startups, or data analytics companies) - This will help you make the correct decisions for your b...
github_jupyter
## Neural Networks in PyMC3 estimated with Variational Inference (c) 2016 by Thomas Wiecki ## Current trends in Machine Learning There are currently three big trends in machine learning: **Probabilistic Programming**, **Deep Learning** and "**Big Data**". Inside of PP, a lot of innovation is in making things scale us...
github_jupyter
# 1.1 Getting started ## Prerequisites ### Installation This tutorial requires **signac**, so make sure to install the package before starting. The easiest way to do so is using conda: ```$ conda config --add channels conda-forge``` ```$ conda install signac``` or pip: ```pip install signac --user``` Please re...
github_jupyter
<a href="https://colab.research.google.com/github/DJCordhose/ml-workshop/blob/master/notebooks/tf-intro/2020-01-rnn-basics.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Sequences Basics Example, some code and a lot of inspiration taken from: ht...
github_jupyter
``` %load_ext autoreload %autoreload 2 !nvidia-smi from argparse import Namespace import sys import os home = os.environ['HOME'] os.environ['CUDA_VISIBLE_DEVICES'] = '0,1' print(os.environ['CUDA_VISIBLE_DEVICES']) os.chdir(f'{home}/pycharm/automl') # os.chdir(f'{home}/pycharm/automl/search_policies/rnn') sys.path.appe...
github_jupyter
SOP036 - Install kubectl command line interface =============================================== Steps ----- ### Common functions Define helper functions used in this notebook. ``` # Define `run` function for transient fault handling, suggestions on error, and scrolling updates on Windows import sys import os impor...
github_jupyter
``` """ A randomly connected network learning a sequence This example contains a reservoir network of 500 neurons. 400 neurons are excitatory and 100 neurons are inhibitory. The weights are initialized randomly, based on a log-normal distribution. The network activity is stimulated with three different inputs (A, B, ...
github_jupyter
# Basics ``` print("Hello World!") # This is comment! bread=10 print(bread) bread=input() bread 43+5 '43'+5 ``` **Find out the reason behind the above error.** **Tip**: Copy the error and search in [Google](https://www.google.com/). ``` 8 8+3 ``` ### Data Types Integers: -2, -1, 0, 1, 2, 3, 4, 5 Floating-point ...
github_jupyter
# Google form analysis visualizations ## Table of Contents ['Google form analysis' functions checks](#funcchecks) ['Google form analysis' functions tinkering](#functinkering) ``` %run "../Functions/1. Google form analysis.ipynb" ``` ## 'Google form analysis' functions checks <a id=funcchecks /> ## 'Google form a...
github_jupyter
``` from xml.etree import ElementTree from xml.dom import minidom from xml.etree.ElementTree import Element, SubElement, Comment, indent def prettify(elem): """Return a pretty-printed XML string for the Element. """ rough_string = ElementTree.tostring(elem, encoding="ISO-8859-1") reparsed = minidom.par...
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 impor...
github_jupyter
# Random Signals and LTI-Systems *This jupyter notebook is part of a [collection of notebooks](../index.ipynb) on various topics of Digital Signal Processing. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sascha.Spors@uni-rostock.de).* ## Measurement of Acoustic Impulse Responses Th...
github_jupyter
## TCLab Function Help ![connections.png](attachment:connections.png) #### Connect/Disconnect ```lab = tclab.TCLab()``` Connect and create new lab object, ```lab.close()``` disconnects lab. #### LED ```lab.LED()``` Percentage of output light for __Hot__ Light. #### Heaters ```lab.Q1()``` and ```lab.Q2()``` Percenta...
github_jupyter
# Face Generation In this project, you'll use generative adversarial networks to generate new images of faces. ### Get the Data You'll be using two datasets in this project: - MNIST - CelebA Since the celebA dataset is complex and you're doing GANs in a project for the first time, we want you to test your neural netwo...
github_jupyter
**Important**: This notebook is different from the other as it directly calls **ImageJ Kappa plugin** using the [`scyjava` ImageJ brige](https://github.com/scijava/scyjava). Since Kappa uses ImageJ1 features, you might not be able to run this notebook on an headless machine (need to be tested). ``` from pathlib impor...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content-dl/blob/main/tutorials/W1D1_BasicsAndPytorch/student/W1D1_Tutorial1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Tutorial 1: PyTorch **Week 1, Day 1: Basics and ...
github_jupyter
``` from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap from matplotlib import animation from IPython.display import HTML import numpy as np from sklearn.datasets import make_blobs from sklearn.cluster import KMeans %matplotlib inline # Set up colors: color_map = ListedColormap(['#1b9e77',...
github_jupyter
# Programming Assignment ## Готовим LDA по рецептам Как вы уже знаете, в тематическом моделировании делается предположение о том, что для определения тематики порядок слов в документе не важен; об этом гласит гипотеза <<мешка слов>>. Сегодня мы будем работать с несколько нестандартной для тематического моделирования к...
github_jupyter
``` #Author: Eren Ali Aslangiray, Meryem Şahin import pandas as pd import os import time import sys path1 = "/Users/erenmac/Desktop/NEW_DATA/Text/text_emotion.csv" path2 = "/Users/erenmac/Desktop/NEW_DATA/Text/primary-plutchik-wheel-DFE.csv" path3 = "/Users/erenmac/Desktop/NEW_DATA/Text/ssec-aggregated/train-combined-...
github_jupyter
``` import os, re import pandas as pd import numpy as np import requests from bs4 import BeautifulSoup import time import json URL_LIST_BASE = "https://www.dogbreedslist.info/all-dog-breeds/list_1_{}.html" # {} in [1, 19] def get_dog_list_page(n): r = requests.get(URL_LIST_BASE.format(n)) soup = BeautifulSoup(...
github_jupyter
## Dependencies ``` import json, glob from tweet_utility_scripts import * from tweet_utility_preprocess_roberta_scripts_aux import * from transformers import TFRobertaModel, RobertaConfig from tokenizers import ByteLevelBPETokenizer from tensorflow.keras import layers from tensorflow.keras.models import Model ``` # L...
github_jupyter
# Binary trees ``` import matplotlib.pyplot as plt from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor from dtreeviz.trees import * from lolviz import * import numpy as np import pandas as pd %config InlineBackend.figure_format = 'retina' ``` ## Setup Make sure to install stuff: ``` pip install...
github_jupyter
``` # reload packages %load_ext autoreload %autoreload 2 ``` ### Choose GPU (this may not be needed on your computer) ``` %env CUDA_DEVICE_ORDER=PCI_BUS_ID %env CUDA_VISIBLE_DEVICES='' ``` ### load packages ``` from tfumap.umap import tfUMAP import tensorflow as tf import numpy as np import matplotlib.pyplot as plt...
github_jupyter
``` import sys sys.executable ``` [Optional]: If you're using a Mac/Linux, you can check your environment with these commands: ``` !which pip3 !which python3 !ls -lah /usr/local/bin/python3 ``` ``` !pip3 install -U pip !pip3 install torch==1.3.0 !pip3 install seaborn import torch torch.cuda.is_available() # IPython ...
github_jupyter
# DBSCAN without Libraries ``` import time import warnings import queue import numpy as np import pandas as pd from sklearn import cluster, datasets, mixture from sklearn.neighbors import kneighbors_graph from sklearn import datasets # from sklearn.datasets import make_blobs from sklearn.preprocessing import Standar...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
# BiDirectional LSTM classifier in keras #### Load dependencies ``` import keras from keras.datasets import imdb from keras.preprocessing.sequence import pad_sequences from keras.models import Sequential from keras.layers import Embedding, SpatialDropout1D, Dense, Flatten, Dropout, LSTM from keras.layers.wrappers imp...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from skimage.color import rgb2gray from skimage.filters import gaussian import scipy import cv2 from scipy import ndimage import Image_preperation as prep import FitFunction as fit import FileManager as fm import Image_preperation as prep def calc_mean(points)...
github_jupyter
``` __name__ = "k1lib.callbacks" #export from .callbacks import Callback, Callbacks, Cbs import k1lib, os, torch __all__ = ["Autosave", "DontTrainValid", "InspectLoss", "ModifyLoss", "Cpu", "Cuda", "DType", "InspectBatch", "ModifyBatch", "InspectOutput", "ModifyOutput", "Beep"] #export @k1lib.pat...
github_jupyter
``` from aide_design.play import* from aide_design import floc_model as floc from aide_design import cdc_functions as cdc from aide_design.unit_process_design.prefab import lfom_prefab_functional as lfom from pytexit import py2tex import math ``` # 1 L/s Plants in Parallel # CHANCEUX ## Priya Aggarwal, Sung Min Kim, ...
github_jupyter
``` from pysead import Truss_2D import numpy as np from random import random import matplotlib.pyplot as plt # initialize node dictionary nodes = {} # compute distances distances_1 = np.arange(0,5*240,240) distances_2 = np.arange(0,9*120,120) # from node 1 to node 5 for i, distance in enumerate(distances_1): node...
github_jupyter
``` import os import sys import keras import numpy as np import tensorflow as tf from keras import datasets import matplotlib import matplotlib.pyplot as plt sys.path.append(os.getcwd() + "/../") from bfcnn import BFCNN, collage, get_conv2d_weights # setup environment os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" tf.compa...
github_jupyter
# Task 4: Classification _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, ensure Matp...
github_jupyter
# "Build Your First Neural Network with PyTorch" * article <https://curiousily.com/posts/build-your-first-neural-network-with-pytorch/> * dataset <https://www.kaggle.com/jsphyg/weather-dataset-rattle-package> requires `torch 1.4.0` ``` import os from os.path import dirname import numpy as np import pandas as p...
github_jupyter
# Scraping transfermarkt by html ``` from selenium.webdriver import (Chrome, Firefox) import time import requests from bs4 import BeautifulSoup from html_scraper import db players = db['players'] player_urls = db['player_urls'] browser = Firefox() url = 'https://www.transfermarkt.co.uk/primera-division/startseite/wet...
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
``` %matplotlib inline import pandas as pd import xgboost as xgb import numpy as np from sklearn.metrics import accuracy_score import matplotlib.pyplot as plt import graphviz from sklearn.preprocessing import LabelEncoder data = pd.read_csv("data/telco-churn.csv") data.head() data.shape data.drop('customerID', axis = 1...
github_jupyter
# ロジスティック写像 $$ f(x, a) = a x (1 - x) $$ ``` import numpy as np import pathfollowing as pf import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline sns.set('poster', 'whitegrid', 'dark', rc={"lines.linewidth": 2, 'grid.linestyle': '-'}) def func(x, a): return np.array([a[0] * x[0] * (1.0 - x[0])]) ...
github_jupyter
## Part 2: Introduction to Feed Forward Networks ### 1. What is a neural network? #### 1.1 Neurons A neuron is software that is roughly modeled after the neuons in your brain. In software, we model it with an _affine function_ and an _activation function_. One type of neuron is the perceptron, which outputs a bina...
github_jupyter
``` import tensorflow as tf print(tf.__version__) import tensorflow_datasets as tfds print(tfds.__version__) ``` # Get dataset ``` SPLIT_WEIGHTS = (8, 1, 1) splits = tfds.Split.TRAIN.subsplit(weighted=SPLIT_WEIGHTS) (raw_train, raw_validation, raw_test), metadata = tfds.load('cats_vs_dogs', ...
github_jupyter
# Optimización Author: Jesús Cid-Sueiro Jerónimo Arenas-García Versión: 0.1 (2019/09/13) 0.2 (2019/10/02): Solutions added ## Exercise: compute the minimum of a real-valued function The goal of this exercise is to implement and test optimization algorithms for the minimization o...
github_jupyter
# Example 3. CNN + DDA Here, we train the same CNN as in previous notebook but applying the Direct Domain Adaptation method (DDA) to reduce the gap between MNIST and MNIST-M datasets. ------- This code is modified from [https://github.com/fungtion/DANN_py3](https://github.com/fungtion/DANN_py3). ``` import os import...
github_jupyter
## Swow On and Free Scenes ``` from plot_helpers import * plt.style.use('fivethirtyeight') casi_data = PixelClassifier(CASI_DATA, CLOUD_MASK, VEGETATION_MASK) hillshade = RasterFile(HILLSHADE, band_number=1).band_values() snow_on_diff_data = RasterFile(SNOW_ON_DIFF, band_number=1) band_values_snow_on_diff = snow_on_...
github_jupyter
## Dependencies ``` !pip install --quiet efficientnet import warnings, time from kaggle_datasets import KaggleDatasets from sklearn.model_selection import KFold from sklearn.metrics import classification_report, confusion_matrix, accuracy_score from tensorflow.keras import optimizers, Sequential, losses, metrics, Mode...
github_jupyter
``` # Ricordati di eseguire questa cella con Shift+Invio import sys sys.path.append('../') import jupman ``` # Stringhe 4 - iterazione e funzioni ## [Scarica zip esercizi](../_static/generated/strings.zip) [Naviga file online](https://github.com/DavidLeoni/softpython-it/tree/master/strings) ### Che fare - scompat...
github_jupyter
## Indexing in NumPy ### np.where vs masking * np.where returns just the indices where the equivalent mask is true * this is useful if you need the actual indices (maybe for counts) * otherwise the shorthand notation (masking) is perhaps easier * np.where returns a tuple ### Why do I care? You may need ...
github_jupyter
## Bayesian Optimisation Verification ``` import numpy as np import pandas as pd from matplotlib import pyplot as plt from matplotlib.colors import LogNorm from scipy.interpolate import interp1d from scipy import interpolate from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.ke...
github_jupyter
# MODIS MODIS Terra: https://lpdaac.usgs.gov/products/mod11c1v006/ MODIS Acqua: https://lpdaac.usgs.gov/products/myd11c1v061/ Docs: https://lpdaac.usgs.gov/documents/118/MOD11_User_Guide_V6.pdf ``` ! wget https://e4ftl01.cr.usgs.gov/MOLA/MYD11C1.061/2018.04.19/MYD11C1.A2018109.061.2021330052306.hdf -O /network/gr...
github_jupyter
# ODE solver In this notebook, we show some examples of solving an ODE model. For the purposes of this example, we use the Scipy solver, but the syntax remains the same for other solvers ``` %pip install pybamm -q # install PyBaMM if it is not installed import pybamm import tests import numpy as np import os impor...
github_jupyter
## 初始化 ``` import sys,os root_path = os.path.abspath('../../../../') sys.path.append(root_path) root_path import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import src.features.factors.consolidate_factor as cf import src.visualization.plotting as pt ``` ## 整理数据 ``` fp = roo...
github_jupyter
<a href="https://colab.research.google.com/github/muhdlaziem/DR/blob/master/Testing_3_all.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` from google.colab import drive drive.mount('/gdrive') %cd /gdrive/'My Drive'/ %tensorflow_version 1.x # im...
github_jupyter
[View in Colaboratory](https://colab.research.google.com/github/DillipKS/MLCC_assignments/blob/master/feature_sets.ipynb) #### Copyright 2017 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 ...
github_jupyter
<a href="https://colab.research.google.com/github/desaibhargav/VR/blob/main/notebooks/Semantic_Search.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## **Dependencies** ``` !pip install -U -q sentence-transformers !git clone https://github.com/des...
github_jupyter
# USGS Earthquakes with the Mapboxgl-Jupyter Python Library https://github.com/mapbox/mapboxgl-jupyter ``` # Python 3.5+ only! import asyncio from aiohttp import ClientSession import json, geojson, os, time import pandas as pd from datetime import datetime, timedelta from mapboxgl.viz import * from mapboxgl.utils impo...
github_jupyter
Using min and max in another way Just passing minrange and maxrange r / \ / \ min, r-1 r, max ``` import queue class BinaryTreeNode: def __init__(self, data): self.data = data self.left = None self.right = None def minTree(root)...
github_jupyter
``` %matplotlib inline ``` Saving and loading models for inference in PyTorch ================================================== There are two approaches for saving and loading models for inference in PyTorch. The first is saving and loading the ``state_dict``, and the second is saving and loading the entire model. ...
github_jupyter
# Sampling the potential energy surface ## Introduction This interactive notebook demonstrates how to utilize the Potential Energy Surface (PES) samplers algorithm of qiskit chemistry to generate the dissociation profile of a molecule. We use the Born-Oppenhemier Potential Energy Surface (BOPES)and demonstrate how t...
github_jupyter
# 實驗:實作InceptionV3網路架構 <table class="tfo-notebook-buttons" align="left"> <td> <a target="_blank" href="https://colab.research.google.com/github/taipeitechmmslab/MMSLAB-TF2/blob/master/Lab8.ipynb"><img src="https://www.tensorflow.org/images/colab_logo_32px.png" />Run in Google Colab</a> </td> <td> <a targ...
github_jupyter
``` %matplotlib notebook import pickle import numpy as np import matplotlib.pyplot as plt from refnx.reflect import SLD, Slab, ReflectModel, MixedReflectModel from refnx.dataset import ReflectDataset as RD from refnx.analysis import Objective, CurveFitter, PDF, Parameter, process_chain, load_chain from FreeformVFP i...
github_jupyter
# Iterative reconstruction of undersampled MR data This demonstration shows how to hande undersampled data and how to write a simple iterative reconstruction algorithm with the acquisition model. This demo is a 'script', i.e. intended to be run step by step in a Python notebook such as Jupyter. It is organised in 'ce...
github_jupyter
# k-Nearest Neighbor (kNN) exercise *Complete and hand in this completed worksheet (including its outputs and any supporting code outside of the worksheet) with your assignment submission. For more details see the [assignments page](http://vision.stanford.edu/teaching/cs231n/assignments.html) on the course website.* ...
github_jupyter
### Forced Alignment with Wav2Vec2 In this notebook we are going to follow [this pytorch tutorial](https://pytorch.org/tutorials/intermediate/forced_alignment_with_torchaudio_tutorial.html) to align script to speech with torchaudio using the CTC segmentation algorithm described in [ CTC-Segmentation of Large Corpora f...
github_jupyter
``` import pandas as pd import random ``` ### Read the data ``` movies_df = pd.read_csv('mymovies.csv') ratings_df = pd.read_csv('myratings.csv') ``` ### Select the data The recommender system should avoid bias, for example, the recommender system should not recommend movie with just 1 rating which is also a 5-star ...
github_jupyter
# Call stacks and recursion In this notebook, we'll take a look at *call stacks*, which will provide an opportunity to apply some of the concepts we've learned about both stacks and recursion. ### What is a *call stack*? When we use functions in our code, the computer makes use of a data structure called a **call sta...
github_jupyter
# GLM: Logistic Regression * This is a reproduction with a few slight alterations of [Bayesian Log Reg](http://jbencook.github.io/portfolio/bayesian_logistic_regression.html) by J. Benjamin Cook * Author: Peadar Coyle and J. Benjamin Cook * How likely am I to make more than $50,000 US Dollars? * Exploration of model ...
github_jupyter
``` import numpy from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten, Activation from keras.layers.convolutional import Conv2D, MaxPooling2D from keras.layers.normalization import BatchNormalization from keras.utils import to_categorical from keras import backend as K from keras.wrappe...
github_jupyter
``` import os import sys module_path = os.path.abspath('..') sys.path.append(module_path) from lc.measurements import CurveMeasurements from lc.curve import LearningCurveEstimator from omegaconf import OmegaConf ``` Load error measurements using `CurveMeasurements`. See `notebooks/measurements.ipynb` for more about re...
github_jupyter
# Exercises ## Playing with the interpreter Try to execute some simple statements and expressions (one at a time) e.g ``` print("Hello!") 1j**2 1 / 2 1 // 2 5 + 5 10 / 2 + 5 my_tuple = (1, 2, 3) my_tuple[0] = 1 2.3**4.5 ``` Do you understand what is going on in all cases? Most Python functions and objects can provide...
github_jupyter
**_Privacy and Confidentiality Exercises_** This notebook shows you how to prepare your results for export and what you have to keep in mind in general when you want to export output. You will learn how to prepare files for export so they meet our export requirements. ``` # Load packages %pylab inline from __future__...
github_jupyter
# Logistic Regression with Hyperparameter Optimization (scikit-learn) <a href="https://colab.research.google.com/github/VertaAI/modeldb/blob/master/client/workflows/examples-without-verta/notebooks/sklearn-census.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In C...
github_jupyter
# Other widget libraries We would have loved to show you everything the Jupyter Widgets ecosystem has to offer today, but we are blessed to have such an active community of widget creators and unfortunately can't fit all widgets in a single session, no matter how long. This notebook lists some of the widget librarie...
github_jupyter
``` from IPython import display from torch.utils.data import DataLoader from torchvision import transforms, datasets from utils import Logger import tensorflow as tf import numpy as np DATA_FOLDER = './tf_data/VGAN/MNIST' IMAGE_PIXELS = 28*28 NOISE_SIZE = 100 BATCH_SIZE = 100 def noise(n_rows, n_cols): return n...
github_jupyter
# Mining the Social Web, 2nd Edition ## Appendix B: OAuth Primer This IPython Notebook provides an interactive way to follow along with and explore the numbered examples from [_Mining the Social Web (3rd Edition)_](http://bit.ly/Mining-the-Social-Web-3E). The intent behind this notebook is to reinforce the concepts f...
github_jupyter