text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` #!/usr/bin/python # interpolate scalar gradient onto nedelec space import petsc4py import sys petsc4py.init(sys.argv) from petsc4py import PETSc from dolfin import * # from MatrixOperations import * import numpy as np import PETScIO as IO import common import scipy import scipy.io import time import scipy.spars...
github_jupyter
#### 1 - 3 summarized below: #### Lineraly Seperable Experiment - **Training data:** X training points were randomly generated (values bounded between -100 and 100). Y training labels were generated by applying a randomly generated target function to the X training points. - **Test data:** X test points were rando...
github_jupyter
# Authorise Notebook server to access Earth Engine This notebook is a reproduction of the workflow originally developed by **Datalab**, which describes how to setup a Google Datalab container in your local machine using Docker. You can check out the full tutorial by going to this link: https://developers.google.com/...
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
``` import scipy as sp import numpy as np import time try: from localgraphclustering import * except: # when the package is not installed, import the local version instead. # the notebook must be placed in the original "notebooks/" folder sys.path.append("../") from localgraphclustering import * ...
github_jupyter
``` !wget https://gitlab.com/federicozzo/electiveai/raw/master/Desktop/uni/elective_AI/electiveai/bdd100K_img.zip?inline=false from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf import numpy as np import IPython.display as display import cv2 import json import os ...
github_jupyter
## 📍 The Data This example considers a hierarchical dataset. The world is split by continents. Continents are split by country. Each country has a value (population size). Our goal is to represent each country as a circle, its size being proportional to its population. Let's create such a dataset: ``` data = [{'id'...
github_jupyter
# Introduction This tutorial illustrates how to use *ObjTables* to revision datasets, revision schemas, and migrate datasets between revisions of their schemas. This tutorial uses an address book of CEOs as an example. # Define a schema for an address book First, as described in [Tutorial 1](1.%20Building%20and%20vi...
github_jupyter
## Scalability Experiment (Section 5.3) The experiment is designed to compare the execution time of different coarsening schemes over increasingly large graphs. * For consistency, we use a regular graph of increasing size (vertices, edges) but always the same degree * The reduction is fixed to 0.5. The execution time...
github_jupyter
# Fairness and Explainability with SageMaker Clarify 1. [Overview](#Overview) 1. [Prerequisites and Data](#Prerequisites-and-Data) 1. [Initialize SageMaker](#Initialize-SageMaker) 1. [Download data](#Download-data) 1. [Loading the data: Adult Dataset](#Loading-the-data:-Adult-Dataset) 1. [Data inspect...
github_jupyter
This notebook was prepared by [Donne Martin](http://donnemartin.com). Source and license info is on [GitHub](https://github.com/donnemartin/data-science-ipython-notebooks). # Kaggle Machine Learning Competition: Predicting Titanic Survivors * Competition Site * Description * Evaluation * Data Set * Setup Imports and ...
github_jupyter
<a href="https://colab.research.google.com/github/kpe/bert-for-tf2/blob/master/examples/movie_reviews_with_bert_for_tf2_on_gpu.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> This is a modification of https://github/google-research/bert/blob/master/...
github_jupyter
# The soil production function This lesson produced by Simon M Mudd and Fiona J Clubb. Last update (13/09/2021) Back in the late 1800s, people (including G.K. Gilbert) were speculating about the rates at which soil was formed. This might depend on things like the number of burrowing animals, the rock type, the number...
github_jupyter
# Smart signatures with ASA #### 06.3 Writing Smart Contracts ##### Peter Gruber (peter.gruber@usi.ch) 2022-01-12 * Use Smart Signatures with ASAs * Design a contract for token burning ## Setup See notebook 04.1, the lines below will always automatically load functions in `algo_util.py`, the five accounts and the Pur...
github_jupyter
# Homework 4 - Reinforcement Learning in a Smart Factory Optimization of the robots route for pick-up and storage of items in a warehouse: 1. Implement a reinforcement-learning based algorithm 2. The robot is the agent and decides where to place the next part 3. Use the markov decision process toolbox for your soluti...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import yaml import sys sys.path.insert(0,'/Users/ruhl/code/jbolo/python/') from jbolo_funcs import * !ls yamls FIXED_PSAT = True def pwv_vary(yamlfile,site,def_pwv): #expt_yaml = 'yamls/SAT_LFMF_20211210.yaml' sim = yaml.safe_load(open(yamlfile)) ...
github_jupyter
--- _You are currently looking at **version 1.2** of this notebook. To download notebooks and datafiles, as well as get help on Jupyter notebooks in the Coursera platform, visit the [Jupyter Notebook FAQ](https://www.coursera.org/learn/python-social-network-analysis/resources/yPcBs) course resource._ --- # Assignmen...
github_jupyter
# Practice for understanding image classification with neural network - Single layer neural network with gradient descent ## 1) Import Packages ``` from PIL import Image import numpy as np import matplotlib.pyplot as plt import random from sklearn.model_selection import train_test_split from sklearn.preprocessing im...
github_jupyter
# Dataoverføring og statistikk ## Lese inn en fil `pylab.loadtxt(<filename>[, delimiter=hva man skiller dataene med (',')][, skiprows=antalllinjer å hoppe over][, dtype=datatype])` ``` import pylab data = pylab.loadtxt("sunspots.csv", delimiter=",", skiprows=1) nr = data[:, 0] verdi = data[:, 1] pylab.plot(nr, ve...
github_jupyter
# Competition coefficient ``` # Housekeeping library(car) library(ggplot2) library(MASS) library(mgcv) library(nlme) library(reshape2) library(scales) library(tidyr) source("../source.R") # Read in data species_composition = read.table("../../../data/amplicon/species_composition_relative_abundance.txt", ...
github_jupyter
# Iterables Some steps in a neuroimaging analysis are repetitive. Running the same preprocessing on multiple subjects or doing statistical inference on multiple files. To prevent the creation of multiple individual scripts, Nipype has as execution plugin for ``Workflow``, called **``iterables``**. <img src="../stati...
github_jupyter
# Сериализация ## Обработка конфигурационных файлов ### json JSON (JavaScript Object Notation) - простой формат обмена данными, основанный на подмножестве синтаксиса JavaScript. Модуль json позволяет кодировать и декодировать данные в удобном формате. Некоторые возможности библиотеки **json** **json.dump**`(obj, f...
github_jupyter
# JS vs PY automl: who will win? Here an instance of a rather simplistic automl implementation in Python is pitted against implementation in JS. Does the JS version of AutoML reach the quality standards of even a simple Python version? Find out in this notebook. ``` from subprocess import call, DEVNULL import numpy a...
github_jupyter
# Custom generators ``` import tohu from tohu.v4.primitive_generators import * from tohu.v4.derived_generators import * from tohu.v4.dispatch_generators import * from tohu.v4.custom_generator import * from tohu.v4.utils import print_generated_sequence, make_dummy_tuples print(f'Tohu version: {tohu.__version__}') ``` ...
github_jupyter
# 2つのガウス分布を含む混合ガウス分布のためのEMアルゴリズム (細かいコメントはもうちょっと待ってくださーい) 千葉工業大学 上田 隆一 (c) 2017 Ryuichi Ueda This software is released under the MIT License, see LICENSE. ## はじめに このコードは、2つの2次元ガウス分布を含む混合ガウス分布から生成されたデータについて、EMアルゴリズムでパラメータを求めるためのEMアルゴリズムの実装例です。処理の流れは、次のようなものです。 * (準備)2つのガウス分布からサンプリング * 推定対象は、この2つのガウス分布のパラメータと、どち...
github_jupyter
# Description This notebook documents allows the following on a group seven LIFX Tilechain with 5 Tiles laid out horizontaly as following T1 [0] [1] [2] [3] [4] T2 [0] [1] [2] [3] [4] T3 [0] [1] [2] [3] [4] T4 [0] [1] [2] [3] [4] T5 [0] [1] [2] [3] [4] T6 [0] [1] [2] [3] [4] T7 [0] [1] [2] [3] [4...
github_jupyter
# Delicious Asian and Indian Cuisines Install Imblearn which will enable SMOTE. This is a Scikit-learn package that helps handle imbalanced data when performing classification. (https://imbalanced-learn.org/stable/) ``` pip install imblearn import pandas as pd import matplotlib.pyplot as plt import matplotlib as mpl ...
github_jupyter
## _*LiH dissociation curve using VQE with UCCSD variational form*_ This notebook demonstrates using Qiskit Chemistry to plot graphs of the ground state energy of the Lithium Hydride (LiH) molecule over a range of inter-atomic distances using VQE and UCCSD. It is compared to the same energies as computed by the ExactE...
github_jupyter
## Manual publication DB insertion from raw text using syntax features ### Publications and conferences of Prof. Darabant Sergiu Adrian #### http://www.cs.ubbcluj.ro/~dadi/ ``` text = """ A Versatile 3D Face Reconstruction from Multiple Images for Face Shape Classification Conference Paper Sep 2019 Alexandru Ion Marin...
github_jupyter
``` # General Dependencies import os import numpy as np # Denoising dependencies from trefide.pmd import batch_decompose,\ batch_recompose,\ overlapping_batch_decompose,\ overlapping_batch_recompose,\ determine_thresholds ...
github_jupyter
All data credits belong to the wonderful work done by **Rekhta foundation**. Data has been parsed into Urdu, Hindi and English translieration thanks to their excellent data organization. Consider supporting them for their great work in pushing the urdu language. ![image.png](attachment:image.png) Credits to these au...
github_jupyter
# Create a Pipeline You can perform the various steps required to ingest data, train a model, and register the model individually by using the Azure ML SDK to run script-based experiments. However, in an enterprise environment it is common to encapsulate the sequence of discrete steps required to build a machine learn...
github_jupyter
``` from IPython.core.display import HTML def css_styling(): styles = open("./styles/custom.css", "r").read() return HTML(styles) css_styling() ``` # Approximate solutions to the Riemann Problem ## Solutions in practice Solutions to the Riemann problem are mainly used in two contexts: 1. As reference soluti...
github_jupyter
# Regression Week 5: LASSO (coordinate descent) In this notebook, you will implement your very own LASSO solver via coordinate descent. You will: * Write a function to normalize features * Implement coordinate descent for LASSO * Explore effects of L1 penalty # Fire up graphlab create Make sure you have the latest v...
github_jupyter
# Simple Hello World example for IBM Cloud Functions PyWren This is a simple Hello World example, showing how to take a function and run it with pywren. First we import the necessary libraries to run our functions. ``` import numpy as np import os ``` It is possible to use pywren_ibm_cloud inside IBM Watson Studio o...
github_jupyter
``` import numpy as np import tensorflow as tf import matplotlib.pylab as plt from modules.spectral_pool import max_pool, l2_loss_images from modules.frequency_dropout import test_frequency_dropout from modules.create_images import open_image, downscale_image from modules.utils import load_cifar10 np.set_printoptions...
github_jupyter
# How to use OpenNMT-py as a Library The example notebook (available [here](https://github.com/OpenNMT/OpenNMT-py/blob/master/docs/source/examples/Library.ipynb)) should be able to run as a standalone execution, provided `onmt` is in the path (installed via `pip` for instance). Some parts may not be 100% 'library-fri...
github_jupyter
# Pessimistic Neighbourhood Aggregation for States in Reinforcement Learning *Author: Maleakhi Agung Wijaya Supervisors: Marcus Hutter, Sultan Javed Majeed Date Created: 21/12/2017* ``` import random import math import sys import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sn...
github_jupyter
# Decisions This notebook is based on materials kindly provided by the [IN1900]( https://www.uio.no/studier/emner/matnat/ifi/IN1900/h19/) team. How can we use Python to automatically recognize different features in our data, and take a different action for each? Here, we will learn how to write code that executes onl...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt ``` # **COVID-19 Twitter Sentiments** # A. **Problem**: Do Twitter-tweet sentiments have any correlations with COVID19 death counts? That is, do states with higher death counts have a particular sentiment correlated to its tweets? # **B. Data...
github_jupyter
### Integrate plot Qarpo is a library to build a jupyter notebook user interface to submit jobs to job scheduler, display output interface to display accomplished jobs' outputs and plot its results. This notebook provides a recipe to integrate plot displaying the results of accomplished jobs in the jupyter notebook T...
github_jupyter
# Наработки ``` import open3d as o3d import numpy as np def convert_from_bin_to_pcd(path_to_binary_file: str, path_to_new_pcd_file: str): bin_pcd = np.fromfile(path_to_binary_file, dtype=np.float32) points = bin_pcd.reshape((-1, 4))[:, 0:3] o3d_pcd = o3d.geometry.PointCloud(o3d.utility.Vector3dVector(point...
github_jupyter
![Pattern Match](https://pattern-match.com/img/new-logo.png) # **Amazon SageMaker in Practice - Workshop** ## **Click-Through Rate Prediction** This lab covers the steps for creating a click-through rate (CTR) prediction pipeline. The source code of the workshop prepared by [Pattern Match](https://pattern-match.com) ...
github_jupyter
<a href="https://colab.research.google.com/github/patprem/IMDb-SentimentAnalysis/blob/main/SentimentAnalysis.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> **Sentiment Analysis of IMDb Movie Reviews** Importing the basic and required libraries use...
github_jupyter
### Linear Problem ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import torch from torch.utils.data import DataLoader, Dataset import seaborn as sns from torch import nn from torch.nn import functional as F ``` ### Data Preparation ``` data = pd.read_csv('data/test.csv') data.head() sns....
github_jupyter
# NBAiLab - Finetuning and Evaluating a BERT model for NER and POS <img src="https://raw.githubusercontent.com/NBAiLab/notram/master/images/nblogo_2.png"> In this notebook we will finetune the [NB-BERTbase Model](https://github.com/NBAiLab/notram) released by the National Library of Norway. This is a model trained on...
github_jupyter
# Table of Contents <p><div class="lev1"><a href="#Introduction-to-Pandas"><span class="toc-item-num">1&nbsp;&nbsp;</span>Introduction to Pandas</a></div><div class="lev2"><a href="#Pandas-Data-Structures"><span class="toc-item-num">1.1&nbsp;&nbsp;</span>Pandas Data Structures</a></div><div class="lev3"><a href="#Seri...
github_jupyter
# Scalar and vector > Marcos Duarte, Renato Naville Watanabe > [Laboratory of Biomechanics and Motor Control](http://pesquisa.ufabc.edu.br/bmclab) > Federal University of ABC, Brazil <h1>Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Python-setup" data-toc-mod...
github_jupyter
<img src="images/logo.jpg" style="display: block; margin-left: auto; margin-right: auto;" alt="לוגו של מיזם לימוד הפייתון. נחש מצויר בצבעי צהוב וכחול, הנע בין האותיות של שם הקורס: לומדים פייתון. הסלוגן המופיע מעל לשם הקורס הוא מיזם חינמי ללימוד תכנות בעברית."> # <span style="text-align: right; direction: rtl; float: r...
github_jupyter
``` from __future__ import absolute_import from __future__ import division from __future__ import print_function import datetime import tensorflow as tf import tflearn import numpy as np from sklearn.model_selection import train_test_split import drqn import student as st import data_generator as dg import concept_d...
github_jupyter
# Image Compression and Decompression ## Downloading the data and preprocessing it ``` from keras.datasets import mnist import numpy as np (x_train, _), (x_test, _) = mnist.load_data() x_train = x_train.astype('float32') / 255. x_test = x_test.astype('float32') / 255. print(x_train.shape,x_test.shape) x_train = np...
github_jupyter
# Publications markdown generator for academicpages Takes a TSV of publications with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook ([see more info here](http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what_is_jupyter....
github_jupyter
# Causal Discovery using a Perfect Oracle A perfect oracle is a conditional independence (CI) test that always yields the true answer. For that, the oracle requires access to the true underlying graph from which it can read-off the true conditional independence relation. Although this is impractical, access to the tru...
github_jupyter
``` import pandas as pd import pyspark.sql.functions as F from datetime import datetime from pyspark.sql.types import * from pyspark import StorageLevel import numpy as np pd.set_option("display.max_rows", 1000) pd.set_option("display.max_columns", 1000) pd.set_option("mode.chained_assignment", None) from pyspark.ml i...
github_jupyter
This application demonstrates how to build a simple neural network using the Graph mark. Interactions can be enabled by adding event handlers (click, hover etc) on the nodes of the network. See the [Mark Interactions notebook](../Interactions/Mark Interactions.ipynb) and the [Scatter Notebook](../Marks/Scatter.ipynb)...
github_jupyter
# TF-Slim Walkthrough This notebook will walk you through the basics of using TF-Slim to define, train and evaluate neural networks on various tasks. It assumes a basic knowledge of neural networks. ## Table of contents <a href="#Install">Installation and setup</a><br> <a href='#MLP'>Creating your first neural netwo...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W1D5_DimensionalityReduction/student/W1D5_Tutorial1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neuromatch Academy: Week 1, Day 5, Tutori...
github_jupyter
# Django UnChained <img src="images/django.jpg"> # View <img src="https://mdn.mozillademos.org/files/13931/basic-django.png"> # EXP1 # URLs ``` from django.conf.urls import url from . import views app_name = 'polls' urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^(?P<question_id>[0-9]+)/$...
github_jupyter
# Introduction to C++ ## Hello world There are many lessons in writing a simple "Hello world" program - C++ programs are normally written using a text editor or integrated development environment (IDE) - we use the %%file magic to simulate this - The #include statement literally pulls in and prepends the source code...
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 transform = trans...
github_jupyter
**※ GPU環境で利用してください** ``` !pip install timm import argparse import operator import os import time from collections import OrderedDict import timm import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms from PIL import Image from timm.data import create_dataset, create_loader, ...
github_jupyter
# Tutorial 6: Population Level Modeling (with PopNet) In this tutorial we will focus on modeling of populations and population firing rates. This is done with the PopNet simulator application of bmtk which uses [DiPDE](https://github.com/AllenInstitute/dipde) engine as a backend. We will first build our networks using...
github_jupyter
``` import pandas as pd import numpy as np import plotly import matplotlib.pyplot as plt from random import seed from random import randrange from csv import reader from google.colab import drive drive.mount('/content/drive') ''' We proceed as follows: 1. Compute the Gini Index of the Dataset. 2. Create a split of each...
github_jupyter
Evaluation of the frame-based matching algorithm ================================================ This notebook aims at evaluating the performance of the Markov Random Field (MRF) algorithm implemented in `stereovis/framed/algorithms/mrf.py` on the three datasets presented above. For each, the following experiments ha...
github_jupyter
``` %matplotlib inline import numpy as np from sklearn.svm import LinearSVC, SVC from sklearn.preprocessing import MinMaxScaler from sklearn.model_selection import train_test_split from sklearn.decomposition import PCA import matplotlib.pyplot as plt class OVRSVC(): def __init__(self, **kwargs): self.c2svc ...
github_jupyter
``` import os import glob import sys import numpy as np import pickle import tensorflow as tf import PIL import ipywidgets import io """ make sure this notebook is running from root directory """ while os.path.basename(os.getcwd()) in ('notebooks', 'src'): os.chdir('..') assert ('README.md' in os.listdir('./')), '...
github_jupyter
# Similarity Functions This notebook describes about the similarity functions that can be used to measure the similarity between two sets. Firstly we import the shingling functions and other helpful functions. ``` from src.shingle import * from math import ceil, floor import numpy as np ``` We will then count how f...
github_jupyter
<h2><center>Predicting the probability of citation </center></h2> In this section, we predict the probability of receiving citation for the particular violation. We use the random forest model to make the prediction. ``` # Import necessary modules import pandas as pd import matplotlib.pyplot as plt import numpy as np...
github_jupyter
# Numerical solution to the 1-dimensional Time Independent Schroedinger Equation Based on the paper "Matrix Numerov method for solving Schroedinger's equation" by Mohandas Pillai, Joshua Goglio, and Thad G. Walker, _American Journal of Physics_ **80** (11), 1017 (2012). [doi:10.1119/1.4748813](http://dx.doi.org/10.111...
github_jupyter
<a href="https://colab.research.google.com/github/MinCiencia/Datos-COVID19/blob/master/DataObservatory_ex3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <p><img alt="Data Observatory logo" height="150px" src="http://dataobservatory.io/wp-content/t...
github_jupyter
<a href="https://colab.research.google.com/github/rs-delve/tti-explorer/blob/master/notebooks/tti-experiment.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # TTI Explorer #### `tti_explorer` is a library for simulating infection spread. This libra...
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
<center> <img src="https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-DV0101EN-SkillsNetwork/labs/Module%202/images/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # Area Plots, Histograms, and Bar Plots Estimated time needed: **30** minutes ## Objec...
github_jupyter
# Automated ML with azureml The dependencies are imported ``` import os import pandas as pd from azureml.core import Dataset, Datastore, Workspace, Experiment # from azureml.train.automl import AutoMLConfig from azureml.widgets import RunDetails ``` ## Dataset ### Overview We will try to predict the rating of mod...
github_jupyter
<a href="https://colab.research.google.com/drive/1F22gG4PqDIuM0R4zbzEKu1DlGbnHeNxM?usp=sharing" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> By [Ibrahim Sobh](https://www.linkedin.com/in/ibrahim-sobh-phd-8681757/) ## In this code, we are going to imple...
github_jupyter
# Searching and sorting Now we're getting more into the 'numerical methods' part of the course! Today, we will delve into the following: * how to write **pseudo code** * **computational complexity** (big-O notion). * **search algorithms** (sequential, binary) * **sort algorithms** (bubble, insertion, quick) **...
github_jupyter
``` import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import matplotlib.pyplot as plt from sklearn.linear_model import Ridge from sklearn.metrics import mean_squared_error from sklearn.ensemble import RandomForestRegressor from sklearn.linear_model import Ridg...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Image/image_overview.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="h...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import sys from src.config import config from scipy.stats import pearsonr cdr_dhs_other = pd.DataFrame(pd.read_csv('data/processed/civ/correlation/master_cdr_dhs_other.csv')) urb = cdr_dhs_other[cdr_dhs_other['Z_Med'] >= np.median(cdr_dhs_other[...
github_jupyter
# Curve-fit to estimate final dissipation ``` %run base.py %run paths.py from base import * from paths import * %matplotlib ipympl import matplotlib.pyplot as plt def get_teps(short_name): path = paths_sim[short_name] d = SpatialMeansSW1L._load(path) t = d['t'] eps = d['epsK'] + d ['epsA'] id...
github_jupyter
``` import math import os import nemo from nemo.utils.lr_policies import WarmupAnnealing import nemo.collections.nlp as nemo_nlp from nemo.collections.nlp.data import NemoBertTokenizer, SentencePieceTokenizer from nemo.collections.nlp.callbacks.token_classification_callback import \ eval_iter_callback, eval_epoch...
github_jupyter
# Vectorized Execution in SparkR This nootebook demonstrates Arrow optimization with some small data (~10 MB) so that people can actually try out and refer when they run the benchmark in an actual cluster. **Note that** the performance improves far more greatly when the size of data is large. Given my benchmark with ...
github_jupyter
``` #!/usr/bin/env python # coding: utf-8 %matplotlib inline %reload_ext autoreload %autoreload 2 import sys sys.path.insert(0, '../') from pyMulticopterSim.simulation.env import * # execute only if run as a script env = simulation_env() env.proceed_motor_speed("uav1", np.array([1100.0,1100.0,1100.0,1100.0]),0.1) env...
github_jupyter
##### Copyright 2021 The Cirq Developers ``` #@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 agre...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.preprocessing import LabelEncoder from sklearn.cross_validation import train_test_split import seaborn as sns from itertools import combinations_with_replacement sns.set() df = pd.read_csv('TempLinkoping2016.csv') df.head() X = df.i...
github_jupyter
# Announcements - __Please familiarize yourself with the term projects, and sign up for your (preliminary) choice__ using [this form](https://forms.gle/ByLLpsthrpjCcxG89). _You may revise your choice, but I'd recommend settling on a choice well before Thanksgiving._ - Recommended reading on ODEs: [Lecture notes by Prof...
github_jupyter
# Simpson paradoxes over time Copyright 2021 Allen B. Downey License: [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/) [Click here to run this notebook on Colab](https://colab.research.google.com/github/AllenDowney/ProbablyOverthinkingIt2/...
github_jupyter
# scikit-learn - Machine Learning in Python Scikit-learn is a machine learning library for Python. A key feature is that is has been designed to seamlessly interoperate with the scientific libraries NumPy and SciPy, which we have introduced in the previous notebooks, as well as with the graphical library Matplotlib. ...
github_jupyter
##### Copyright 2018 The TensorFlow Authors. [Licensed under the Apache License, Version 2.0](#scrollTo=Afd8bu4xJOgh). ``` // #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" } // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file ...
github_jupyter
# Introduction You've built up your SQL skills enough that the remaining hands-on exercises will use different datasets than you see in the explanations. If you need to get to know a new dataset, you can run a couple of **SELECT** queries to extract and review the data you need. The next exercises are also more chal...
github_jupyter
# 4. Categorical Model Author: _Carlos Sevilla Salcedo (Updated: 18/07/2019)_ This notebook presents the categorical approach of the algorithm. for our model we understand that the view we are analysing is composed of one among several categories (The data given to the model must be an integer). To do so, we have to u...
github_jupyter
# Single NFW profile Here we demonstrate most of the NFW functionality using a single NFW profile. ``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np from profiley.nfw import NFW mass = 1e14 concentration = 4 redshift = 0.5 nfw = NFW(mass, concentration, redshift) print(nfw) ``` Note that the...
github_jupyter
# GraviPy - tutorial ## _Coordinates_ and _MetricTensor_ To start working with the gravipy package you must load the package and initialize a pretty-printing mode in Jupyter environment ``` from gravipy.tensorial import * # import GraviPy package from sympy import init_printing import inspect init_printing() ``` Th...
github_jupyter
``` import re import numpy as np import transformers as ppb #!python -m pip install transformers import torch import pickle import torch.nn as nn import torch.optim as optim from torch.autograd import Variable from torch.utils import data from torchsummary import summary import warnings warnings.filterwarnings('ignor...
github_jupyter
**Connect With Me in Linkedin :-** https://www.linkedin.com/in/dheerajkumar1997/ ## One Hot Encoding - variables with many categories We observed in the previous lecture that if a categorical variable contains multiple labels, then by re-encoding them using one hot encoding we will expand the feature space dramatica...
github_jupyter
# GSEA analysis on leukemia dataset ``` %load_ext autoreload %autoreload 2 from gsea import * import numpy as np %pylab %matplotlib inline ``` ## Load data ``` genes, D, C = read_expression_file("data/leukemia.txt") gene_sets, gene_set_names = read_genesets_file("data/pathways.txt", genes) gene_set_hash = {} for i i...
github_jupyter
# Goal * Follow-up to `atomIncorp_taxaIncorp` simulation run. * Investigating factors that influenced accuracy * e.g., pre-fractionation abundance or G+C of fragments # Setting parameters ``` workDir = '/home/nick/notebook/SIPSim/dev/bac_genome1147/atomIncorp_taxaIncorp/' frag_info_file = '/home/nick/notebook/SIPS...
github_jupyter
``` # Зависимости import pandas as pd import numpy as np import matplotlib.pyplot as plt import random import os from sklearn.model_selection import train_test_split from sklearn.preprocessing import MinMaxScaler, OneHotEncoder from sklearn.compose import ColumnTransformer from sklearn.linear_model import LogisticReg...
github_jupyter
# 15-minutes Realized Variance Notebook This notebook analyzes the best subfrequency for computing the 15-minutes Realized Variance by creating a variance signature plot. ``` # Required libraries # Required libraries from IPython.core.display import display, HTML display(HTML("<style>.container { width:80% !important...
github_jupyter
# Custom Distributions You might want to model input uncertanty with a distribution not currenlty available in Golem. In this case you can create your own class implementing such distribution. Here, we will reimplement a uniform distribution as a toy example. ``` from golem import * import numpy as np import pandas...
github_jupyter