text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Generador Unix Utilizando el generador UNIX de números aleatorios, pero con los coeficientes del generador Visual Basic, programe una serie de 60 números aleatorios en hoja de cálculo, verificando que, a igual semilla corresponde igual serie. Utilice como “Blanco” una serie del mismo tamaño generada con una macro en ...
github_jupyter
## 2. Multi Layer Perceptron ### 1) import modules ``` import tensorflow as tf import numpy as np from tensorflow.examples.tutorials.mnist import input_data from modules import multi_layer_perceptron ``` ### 2) define placeholder for INPUT & LABELS ``` INPUT = tf.placeholder(tf.float32, [None, 28*28]) LABELS = tf...
github_jupyter
# Subpockets to target residue(s) We explore the distance of the `kissim` subpocket centers to their target residues. ``` %load_ext autoreload %autoreload 2 from pathlib import Path import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from opencadd.databases.klifs import setup...
github_jupyter
``` # import os # os.environ['LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH'] = '/home/apanin/cuda-8.0/lib64' # os.environ['PATH'] = "/usr/local/cuda-8.0/bin/:/home/apanin/cuda-8.0/lib64:"+os.environ['PATH'] # %env THEANO_FLAGS=device=cuda0,gpuarray.preallocate=0.5,floatX=float32 # import theano # import theano.tensor a...
github_jupyter
``` import skimage.io as sio import matplotlib.pyplot as plt import numpy as np import pandas as pd import diff_classifier.aws as aws from skimage.filters import roberts, sobel, scharr, prewitt, median, rank from skimage import img_as_ubyte from skimage.morphology import erosion, dilation, opening, closing, white_topha...
github_jupyter
``` import statsmodels.formula.api as smf import matplotlib.pyplot as plt import fastreg as fr from fastreg import I, R, C %config InlineBackend.figure_format = 'retina' %matplotlib inline ``` ### Generate Data ``` models = ['linear', 'poisson', 'negbin', 'zinf_poisson', 'zinf_negbin'] data = fr.dataset(N=1_000_000, ...
github_jupyter
# Chapter 8 ## Question 10 Using boosting to predict `Salary` in the `Hitters` data set ``` import statsmodels.api as sm import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import sklearn.model_selection import sklearn.ensemble import sklearn.tree import sklearn.metrics impo...
github_jupyter
``` #Import Library #Preprocessing import os import cv2 import pandas as pd import numpy as np import tensorflow as tf import scipy.ndimage as ndi from random import shuffle from scipy.misc import imread, imresize from scipy.io import loadmat #Model from keras.preprocessing.image import ImageDataGenerator from sklear...
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. Prepared by **SIT742 Teaching Team** --- # Session 1B - Control Flow, File usage, and...
github_jupyter
# Periodic Signals *This Jupyter notebook is part of a [collection of notebooks](../index.ipynb) in the bachelors module Signals and Systems, Comunications Engineering, Universität Rostock. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sascha.Spors@uni-rostock.de).* ## Spectrum Peri...
github_jupyter
# Homework 07 ### Preparation... Run this code from the lecture to be ready for the exercises below! ``` import glob import os.path import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn import datasets, linear_model, ensemble, neural_network from sklearn.metrics import mean_squared_e...
github_jupyter
``` import torch import numpy as np import matplotlib.pyplot as plt import os import sys; sys.path.append("../src") from models.cgans import AirfoilAoACEGAN, AirfoilAoAGenerator from train_final_cebgan import read_configs, assemble_new_gan from utils.dataloader import AirfoilDataset, NoiseGenerator from torch.util...
github_jupyter
# Single Shot Object Detection SSD (Single Shot Multi-box Detection) is detecting objects in images using a single deep neural network. This tutorial use a model provided from [TensorFlow](https://github.com/tensorflow/examples/blob/master/lite/examples/object_detection/android/README.md). ``` import ( "log" ...
github_jupyter
``` import os import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline import warnings warnings.filterwarnings("ignore") from sklearn.metrics import roc_curve from sklearn.metrics import roc_auc_score from sklearn.metrics import confusion_matrix, ConfusionMa...
github_jupyter
<a href="https://colab.research.google.com/github/loosak/pysnippets/blob/master/Graphs.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Exploring the World of Graphs John Paul Mueller and Luca Massaron: Algorithms For Dummies®, 2nd Edition Graphs...
github_jupyter
<h1 align="center">PROGRAMACIÓN DE COMPUTADORES </h1> <h2 align="center">UNIVERSIDAD EAFIT</h2> <h3 align="center">MEDELLÍN - COLOMBIA </h3> <h2 align="center">Sesión 12 - Ecosistema Python - Matplotlib</h2> ## Instructor: > <strong> *Carlos Alberto Álvarez Henao, I.C. Ph.D.* </strong> ## Matplotlib > Primero hay...
github_jupyter
# Air Quality Monitoring ### Import/Install packages ``` #!pip install git+https://github.com/datakaveri/iudx-python-sdk #!pip install geojsoncontour #!pip install voila #!pip install voila-gridstack # Use !voila airQualityMonitoring.ipynb --enable_nbextensions=True --template=gridstack to launch dashboard or use jup...
github_jupyter
# Complex Numbers as Vectors We saw that a complex number $z = a + bi$ is equivalent to (and therefore can be represented as) the ordered tuple $(a; b)$, which can be plotted in a 2D space. So, complex numbers and 2D points are equivalent. What is more, we can draw a vector from the origin of the coordinate plane to ou...
github_jupyter
# Optimizing Performance Using Numba & Cython ## Numba & Cython: What are they? At a high level, Numba and Cython are both modules that make your Python code run faster. This means we can have the quick prototyping and iteration that Python is known for, while getting the speed we expect from programs written in C. Th...
github_jupyter
# Jupyter We'll be using Jupyter for all of our examples&mdash;this allows us to run python in a web-based notebook, keeping a history of input and output, along with text and images. For Jupyter help, visit: https://jupyter.readthedocs.io/en/latest/content-quickstart.html We interact with python by typing into _cel...
github_jupyter
``` #default_exp nn_utils #export import torchvision import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import matplotlib.pyplot as plt #export def c_imshow(img): npimg = img.numpy() plt.imshow(np.transpose(npimg, (1, 2, 0))) plt.show() #export nn_utils class Flatten(nn...
github_jupyter
In this lab session we will learn how to pre-process feature vectors using numpy. For this purpose, lets create 10 feature vectors that have 5 features. We use numpy.random for generating these examples. ``` import numpy X = numpy.random.randn(10, 5) ``` Lets print this matrix X where each row is a feature vector. `...
github_jupyter
``` from __future__ import division, print_function, unicode_literals %matplotlib inline %config InlineBackend.print_figure_kwargs = {'dpi' : 150} import numpy as np import qinfer as qi import matplotlib.pyplot as plt plt.style.use('ggplot-rq') plt.rcParams['savefig.frameon'] = False ``` ## Example: Impovrishment ## ...
github_jupyter
``` import os import pandas as pd import numpy as np import warnings import pickle import math from collections import OrderedDict, Counter from copy import deepcopy from Bio.PDB import PDBParser, ResidueDepth, PDBIO, Superimposer, Select from Bio.SeqUtils import seq3 from Bio.PDB.vectors import calc_angle from Bio i...
github_jupyter
# Tanzanian Ministry of Water Dataset Modeling **Import libraries** ``` import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder from sklearn.experimental import enable_iterative_imputer from sklearn.impute import KNNImputer, Iterative...
github_jupyter
# Special care should be taken with missing data on this problem. Missing data shall never be filled in the target variable, or the results evaluation would be corrupted. That is a risk on this problem, if things are done without care, because the target variable and the features are the same, only time-shifted. Firs...
github_jupyter
``` # Connect to Google Drive from google.colab import drive drive.mount('/content/drive') # ls /content/drive/MyDrive/ # Copy the dataset from Google Drive to local !cp "/content/drive/MyDrive/CBIS_DDSM.zip" . !unzip -qq CBIS_DDSM.zip !rm CBIS_DDSM.zip cbis_path = 'CBIS_DDSM' # Import libraries %tensorflow_version ...
github_jupyter
# The Pasta Production Problem This tutorial includes everything you need to set up IBM Decision Optimization CPLEX Modeling for Python (DOcplex), build a Mathematical Programming model, and get its solution by solving the model with IBM ILOG CPLEX Optimizer. Table of contents: - [Describe the business problem](#D...
github_jupyter
# Cell Tower Coverage ## Objective and Prerequisites In this example, we'll solve a simple covering problem: how to build a network of cell towers to provide signal coverage to the largest number of people possible. We'll construct a mathematical model of the business problem, implement this model in the Gurobi Pytho...
github_jupyter
# Thesis thoughts and tests, week 1 This is a summary of my work to date. The first cell contains all the helper functions and such, and can be safely skipped. ``` import skimage.io from matplotlib import pyplot as plt import cairocffi as cairo import math, random import numpy as np from IPython.display import Image ...
github_jupyter
## General Exploratory Data Analysi ## General Exploratory Data Analysi ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import math import os.path from datetime import datetime from datetime import date from dateutil import parser #import pickle #import asyncio from datetime import timedelt...
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 Ben Sattelberg and Asa Ben-Hur. The content is availabe [on GitHub](https://github.com/asabenhur/CS345).* *The text is released under the [CC BY-SA license](...
github_jupyter
# Enter State Farm ``` from __future__ import division, print_function %matplotlib inline #path = "data/state/" path = "data/state/sample/" from importlib import reload # Python 3 import utils; reload(utils) from utils import * from IPython.display import FileLink batch_size=64 ``` ## Setup batches ``` batches = ge...
github_jupyter
Basics --- In this example, we'll go over the basics of atom and reside selection in MDTraj. First let's load up an example trajectory. ``` from __future__ import print_function import mdtraj as md traj = md.load('ala2.h5') print(traj) ``` We can also more directly find out how many atoms or residues there are by us...
github_jupyter
# Continuous Control --- Congratulations for completing the second project of the [Deep Reinforcement Learning Nanodegree](https://www.udacity.com/course/deep-reinforcement-learning-nanodegree--nd893) program! In this notebook, you will learn how to control an agent in a more challenging environment, where the goal ...
github_jupyter
``` import sys sys.path.append("functions/") from datastore import DataStore from searchgrid import SearchGrid from crossvalidate import CrossValidate from sklearn.dummy import DummyClassifier from sklearn.metrics import f1_score from sklearn.metrics import roc_auc_score from sklearn.linear_model import LogisticRegress...
github_jupyter
# Rank Classification using BERT on Amazon Review dataset ## Introduction In this tutorial, you learn how to train a rank classification model using [Transfer Learning](https://en.wikipedia.org/wiki/Transfer_learning). We will use a pretrained DistilBert model to train on the Amazon review dataset. ## About the data...
github_jupyter
``` import numpy as np import pandas as pd import seaborn as sns import nibabel as nib import matplotlib.pyplot as plt from nilearn import plotting from os.path import join from glob import glob from matplotlib.colors import LinearSegmentedColormap sns.set_context('talk') def grab_corr(subjects, nodes, task, conditio...
github_jupyter
``` import pandas as pd from sklearn import model_selection from sklearn.linear_model import LogisticRegression from sklearn.tree import DecisionTreeClassifier from sklearn.neighbors import KNeighborsClassifier from sklearn.metrics import accuracy_score from sklearn.metrics import cohen_kappa_score from sklearn.svm...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/FeatureCollection/distance.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
# Resample Data ## Pandas Resample You've learned about bucketing to different periods of time like Months. Let's see how it's done. We'll start with an example series of days. ``` import numpy as np import pandas as pd dates = pd.date_range('10/10/2018', periods=11, freq='D') close_prices = np.arange(len(dates)) cl...
github_jupyter
# Linear Support Vector Regressor with PowerTransformer This Code template is for the Classification task using Support Vector Regressor (SVR) based on the Support Vector Machine algorithm with Power Transformer as Feature Transformation Technique in a pipeline. ### Required Packages ``` import warnings import nump...
github_jupyter
##### Copyright 2021 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
![Egeria Logo](https://raw.githubusercontent.com/odpi/egeria/master/assets/img/ODPi_Egeria_Logo_color.png) ### Egeria Hands-On Lab # Welcome to the Understanding Server Configuration Lab ## Introduction Egeria is an open source project that provides open standards and implementation libraries to connect tools, catal...
github_jupyter
# Obtaining priority data from WIPO PatentScope **Version**: Dec 16 2020 Reference: [Web Scraping using Selenium and Python](https://www.scrapingbee.com/blog/selenium-python/) ## Import the package. ``` from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.common.excepti...
github_jupyter
# Derived generators ``` import tohu from tohu.v6.primitive_generators import * from tohu.v6.derived_generators import * from tohu.v6.generator_dispatch import * from tohu.v6.utils import print_generated_sequence, make_dummy_tuples from datetime import datetime #tohu.v6.logging.logger.setLevel('DEBUG') print(f'Tohu ve...
github_jupyter
``` !git clone https://github.com/PhysicsTeacher13/NFT-Image-Generator.git cd nft-image-generator/ from PIL import Image from IPython.display import display import random import json # Each image is made up a series of traits # The weightings for each trait drive the rarity and add up to 100% background = ["Blue", "...
github_jupyter
<div align="center"> <h1><img width="30" src="https://madewithml.com/static/images/rounded_logo.png">&nbsp;<a href="https://madewithml.com/">Made With ML</a></h1> Applied ML · MLOps · Production <br> Join 30K+ developers in learning how to responsibly <a href="https://madewithml.com/about/">deliver value</a> with ML. ...
github_jupyter
``` import os import requests import json import numpy as np from dotenv import load_dotenv import pandas as pd from pycoingecko import CoinGeckoAPI cg = CoinGeckoAPI() from coinapi_rest_v1.restapi import CoinAPIv1 import datetime, sys load_dotenv() coin_api_key = os.getenv("COIN_API_KEY2") coin_api_key2 = os.getenv(...
github_jupyter
# Exploring violations related to farming activity To run this notebook, load SDWIS csv data files into the folder ``../../../data/sdwis/SDWIS`` ``` import os import numpy as np import pandas as pd %matplotlib inline import matplotlib.pyplot as plt STATE_CODE = 'VT' DATA_DIR = '../../../../data' SDWIS_DIR = os.pat...
github_jupyter
``` import arviz as az import matplotlib.pyplot as plt import numpy as np import pymc as pm import scipy.stats as stats %config InlineBackend.figure_format = 'retina' az.style.use('arviz-darkgrid') ``` #### Code 2.1 ``` ways = np.array([0, 3, 8, 9, 0]) ways / ways.sum() ``` #### Code 2.2 $$Pr(w \mid n, p) = \frac{...
github_jupyter
# Final Prediction Model and Results Now that we have evaluated our model, we can use all the data and build a model to predict values of the future. In this case, we predict Electricity Consumption and Generation in year 2020 in Germany. ## Import Libraries ``` import numpy as np import pandas as pd import matplotl...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-use-adla-as-compute-target.png) # AML P...
github_jupyter
# Data Mining (Bing News) ### Required Packages ``` #!pip install selenium #!pip install beautfulsoup #!pip install webdriver_manager #!pip install pandas #!pip install numpy #!pip install matplotlib from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.common.keys import Keys from sele...
github_jupyter
``` import os import time import numpy as np import pandas as pd import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from torchvision import datasets from torchvision import transforms import matplotlib.pyplot as plt from PIL import Image import os os.environ['...
github_jupyter
# Introduction to data in NCEDC 1. seismic network data 2. earthquake catalog 3. earthquake focal mechanism catalog 4. earthquake phase/polarity data 5. earthquake waveform data ## Prepare modules, file directory ``` import pandas as pd import urllib3 # dfkds # url for different datasets url_station = "https://ncedc....
github_jupyter
# Quick Start This tutorial show how to create a scikit-criteria `Data` structure, and how to feed them inside different multicriteria decisions algorithms. ## Conceptual Overview The multicriteria data are really complex thing; mostly because you need at least 2 totally disconected vectors to decribe your problem:...
github_jupyter
<h1 style="text-align: center;">Data Mining Project 1: Frequent Pattern & Association Rule</h1> <p style="text-align:center;"> 呂伯駿<br> Q56074085<br> NetDB<br> National Cheng Kung University<br> pclu@netdb.csie.ncku.edu.tw </p> ## 1. Introduction Frequent Pattern & Association Rule 是 Data mining 中的...
github_jupyter
# Dataset - US ``` import pandas as pd ``` ## Initialize ``` srcUS = "./time_series_covid19_confirmed_US.csv" dest = "./time_series_covid19_confirmed_US_transformed.csv" stateCoordinates = { "Wisconsin": (44.500000, -89.500000), "West Virginia": (39.000000, -80.500000), "Vermont": (44.000000, -72.699997)...
github_jupyter
# Binary Image Denoising #### *Jiaolong Xu (GitHub ID: [Jiaolong](https://github.com/Jiaolong))* #### This notebook is written during GSoC 2014. Thanks Shell Hu and Thoralf Klein for taking time to help me on this project! This notebook illustrates how to use shogun structured output learning framework for binary im...
github_jupyter
# Text Clustering with Sentence-BERT ``` !pip3 install sentence-transformers !pip install datasets import pandas as pd, numpy as np import torch, os from datasets import load_dataset dataset = load_dataset("amazon_polarity",split="train") dataset corpus=dataset.shuffle(seed=42)[:10000]['content'] pd.Series([len(e.spl...
github_jupyter
# Scientific Languages **Julia**, **Python**, and **R** are three open source languages used for scientific computing today (2020). They all come with a simplistic command line interface where you type in a statement and it is executed immediately, this is the **REPL**, short for read-evaluate-print-loop. The REPL is ...
github_jupyter
# Converting RMarkdown files to SoS notebooks * **Difficulty level**: easy * **Time need to lean**: 10 minutes or less * **Key points**: * `sos convert file.Rmd file.ipynb` converts a Rmarkdown file to SoS notebook. A `markdown` kernel is used to render markdown text with in-line expressions. * `sos convert file.R...
github_jupyter
# Visualization PySwarms implements tools for visualizing the behavior of your swarm. These are built on top of `matplotlib`, thus rendering charts that are easy to use and highly-customizable. In this example, we will demonstrate three plotting methods available on PySwarms: - `plot_cost_history`: for plotting the co...
github_jupyter
## KNN Classifier The model predicts the severity of the landslide (or if there will even be one) within the next 2 days, based on weather data from the past 5 days. Binary Classification yielded a maximum accuracy of 77.53%. Severity Classification (multiple classes) was around 56%. ``` import pandas as pd import num...
github_jupyter
# Machine Learning Using Random Forests *Curtis Miller* A **random forest** is a collection of decision trees that each individually make a prediction for an observation. Each tree is formed from a random subset of the training set. The majority decision among the trees is then the predicted value of an observation. R...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline import pyqg year = 24*60*60*360. # Set up a model which will run for 20 years and start averaging after 10 years. # There are lots of parameters that can be specified as keyword arguments # but we are just using the defaults. m = pyqg.QGModel(tm...
github_jupyter
## Mergesort Implement mergesort. ### Approach Mergesort is a divide-and-conquer algorithm. We divide the array into two sub-arrays, recursively call the function and pass in the two halves, until each sub-array has one element. Since each sub-array has only one element, they are all sorted. We then merge each sub-arr...
github_jupyter
``` from IPython.core.display import display, HTML display(HTML("<style>.container { width:100% !important; }</style>")) ``` # Lecture 3B - Data Integration* # Table of Contents * [Lecture 3B - Data Integration*](#Lecture-12---Data-Integration*) * &nbsp; * [Content](#Content) * [Learning Outcomes](#Learning-Outcom...
github_jupyter
``` %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.metrics.pairwise import cosine_similarity from surprise import Reader, Dataset, SVD import warnings; warnings.simplefilter('ignore') ``` ## Data Preprocessing and Visualization ``` df= pd. ...
github_jupyter
<a href="https://colab.research.google.com/github/anjali0503/Internship-Projects/blob/main/Iris_ML_DTC.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## ***ANJALI RAMLOLARAKH PANDEY*** **TSF GRIP SPARKS FOUNDATION** Prediction using Decision Tre...
github_jupyter
# State preparation with circuit optimization We want to create a circuit that produces the Bell state $\vert\Phi^+\rangle = \dfrac{\vert00\rangle + \vert11\rangle}{\sqrt 2}$. We already know that this state can be produced by a circuit containing a Hadamard gate on the first qubit followed by a CNOT gate [[1](https:/...
github_jupyter
``` ## Necessary packages import numpy as np import pandas as pd import itertools import math import time import os import glob import copy ## Signal Processing from scipy import signal import scipy.io.wavfile as wavfile import scipy.io import librosa # from scipy.fftpack import fft # import adaptfilt as adf ## Visu...
github_jupyter
``` %matplotlib inline ``` `Learn the Basics <intro.html>`_ || `Quickstart <quickstart_tutorial.html>`_ || `Tensors <tensorqs_tutorial.html>`_ || **Datasets & DataLoaders** || `Transforms <transforms_tutorial.html>`_ || `Build Model <buildmodel_tutorial.html>`_ || `Autograd <autogradqs_tutorial.html>`_ || `Optimizat...
github_jupyter
# Saving a model trained with a tabular dataset in fast.ai - Example of saving and reloading a model trained with a tabular dataset in fast.ai. - This notebook is an extension of The example shown here is adapted from the paper by Howard and Gugger https://arxiv.org/pdf/2002.04688.pdf # Prepare the notebook and inge...
github_jupyter
# V0.1.6 - System Identification Using Adaptative Filters Example created by Wilson Rocha Lacerda Junior ## Generating 1 input 1 output sample data The data is generated by simulating the following model: $y_k = 0.2y_{k-1} + 0.1y_{k-1}x_{k-1} + 0.9x_{k-1} + e_{k}$ If *colored_noise* is set to True: $e_{k} = 0.8...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt from keras.layers import Input, Dense, Convolution2D, MaxPooling2D, UpSampling2D from keras.models import Model from keras import regularizers import numpy as np ``` ### Reference : * Blog : building autoencoders in keras : https://blog.keras.io/building-autoencod...
github_jupyter
# 1. Python basics This chapter only gives a short introduction to Python to make the explanations in the following chapters more understandable. A detailed description would be too extensive and would go beyond the scope of this tutorial. Take a look at https://docs.python.org/tutorial/. Now let's take our first ste...
github_jupyter
If you're opening this Notebook on colab, you will probably need to install 🤗 Transformers and 🤗 Datasets. Uncomment the following cell and run it. ``` #! pip install datasets transformers[sentencepiece] sacrebleu ``` If you're opening this notebook locally, make sure your environment has an install from the last v...
github_jupyter
**Loading Data and creating benchmark model** ``` # Defining the path to the Github repository file_url = 'https://raw.githubusercontent.com/PacktWorkshops/The-Data-Science-Workshop/master/Chapter17/Datasets/bank-full.csv' # Loading data using pandas import pandas as pd bankData = pd.read_csv(file_url,sep=";") bankD...
github_jupyter
![Callysto.ca Banner](https://github.com/callysto/curriculum-notebooks/blob/master/callysto-notebook-banner-top.jpg?raw=true) <a href="https://hub.callysto.ca/jupyter/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fcallysto%2Fcurriculum-notebooks&branch=master&subPath=Science/SourcesOfEnergy/resources-and-r...
github_jupyter
``` from pytorch_vision_classifier.pytorch_dataset_samplers import ImbalancedDatasetSampler from pytorch_vision_classifier.pytorch_dataset_preparation import PytorchDatasetPreparation from pytorch_vision_classifier.pytorch_device_manager import DeviceManager from pytorch_vision_classifier.pytorch_model_training import ...
github_jupyter
# Welcome to jupyter notebooks! ### Congratulations, the hardest step is always the first one. This exercise is designed to help you get personal with the format of jupyter notebooks, as well as learn how data is accessed and manipulated in python. ``` name = "Liz" #type your name before the pound sign, make sure yo...
github_jupyter
``` import cvxopt import numpy as np import matplotlib.pyplot as plt import sys sys.path.append('../../pyutils') import metrics ``` # Introduction The predictor $G(X)$ takes values in a discrete set $\mathbb{G}$. The input space is divided into a collection regions labeled according to their clasification. The bou...
github_jupyter
<small><small><i> Introduction to Python for Bioinformatics - available at https://github.com/kipkurui/Python4Bioinformatics. </i></small></small> ## Dictionaries Dictionaries are mappings between keys and items stored in the dictionaries. Unlike lists and tuples, dictionaries are unordered. Alternatively one can thi...
github_jupyter
``` # import numpy as np # import pandas as pd # import matplotlib.pyplot as plt # from laspy.file import File # from pickle import dump, load # import torch # import torch.nn as nn # import torch.nn.functional as F # import torch.optim as optim # import torch.utils.data as udata # from torch.autograd import Variable ...
github_jupyter
``` # This cell is added by sphinx-gallery !pip install mrsimulator --quiet %matplotlib inline import mrsimulator print(f'You are using mrsimulator v{mrsimulator.__version__}') ``` # MCl₂.2D₂O, ²H (I=1) Shifting-d echo ²H (I=1) 2D NMR CSA-Quad 1st order correlation spectrum simulation. The following is a static ...
github_jupyter
``` try: import openmdao.api as om import dymos as dm except ImportError: !python -m pip install openmdao[notebooks] !python -m pip install dymos[docs] import openmdao.api as om import dymos as dm ``` # How do I run two phases parallel-in-time? Complex models sometimes encounter state variable...
github_jupyter
[View in Colaboratory](https://colab.research.google.com/github/ale93111/Unet_dsb2018/blob/master/Unet_weighted_dsb2018.ipynb) ``` !apt-get install -y -qq software-properties-common python-software-properties module-init-tools !add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null !apt-get update -qq 2>&1 >...
github_jupyter
# Performative Prediction: A Case Study in Strategic Classification This notebook replicates the main experiments in [Performative Prediction](https://arxiv.org/abs/2002.06673): - Juan C. Perdomo, Tijana Zrnic, Celestine Mendler-Dünner, Moritz Hardt. "Performative Prediction." arXiv preprint 2002.06673, 2020. Strate...
github_jupyter
# Modeling and Simulation in Python Case study. Copyright 2017 Allen Downey License: [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0) ``` # Configure Jupyter so figures appear in the notebook %matplotlib inline # Configure Jupyter to display the assigned value after an ...
github_jupyter
Use this utlity to update the returns and std_dev fields within investment-options.csv ``` %%javascript IPython.OutputArea.prototype._should_scroll = function(lines) { return false; } # imports import pandas as pd import numpy as np import matplotlib.pyplot as plt from pathlib import Path import brownbear as bb #...
github_jupyter
**Data Description** age: The person's age in years sex: The person's sex (1 = male, 0 = female) cp: The chest pain experienced (Value 1: typical angina, Value 2: atypical angina, Value 3: non-anginal pain, Value 4: asymptomatic) trestbps: The person's resting blood pressure (mm Hg on admission to the hospital) ch...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt plt.rcParams['figure.figsize'] = (12,8) import numpy as np import tensorflow as tf import keras import pandas as pd from keras_tqdm import TQDMNotebookCallback from keras.preprocessing.sequence import pad_sequences def data_generator(batch_size, tfrecord, start_fr...
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
``` %reload_ext autoreload %autoreload 2 import logging import numpy as np # Make analysis reproducible np.random.seed(0) # Enable logging logging.basicConfig(level=logging.INFO) from dask.distributed import Client Client(n_workers=2, threads_per_worker=2, processes=True, memory_limit='25GB') fr...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt df=pd.read_csv('FearData.csv') df.head(22) # Preprocessing : from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_test_split from sklearn.metrics import classification_report,confusion_matrix from itertools im...
github_jupyter
<!--NOTEBOOK_HEADER--> *This notebook contains material from [CBE40455-2020](https://jckantor.github.io/CBE40455-2020); content is available [on Github](https://github.com/jckantor/CBE40455-2020.git).* <!--NAVIGATION--> | [Contents](toc.html) | [2.0 Modeling](https://jckantor.github.io/CBE40455-2020/02.00-Modeling.htm...
github_jupyter
<a href="https://colab.research.google.com/github/dinesh110598/Spin_glass_NN/blob/master/main.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Classifying Bimodal triangular EA lattices The Hamiltonian for the EA model on a 2d triangular lattice wi...
github_jupyter
# 线性回归 --- 从0开始 虽然强大的深度学习框架可以减少很多重复性工作,但如果你过于依赖它提供的便利抽象,那么你可能不会很容易地理解到底深度学习是如何工作的。所以我们的第一个教程是如何只利用ndarray和autograd来实现一个线性回归的训练。 ## 线性回归 给定一个数据点集合`X`和对应的目标值`y`,线性模型的目标是找一根线,其由向量`w`和位移`b`组成,来最好地近似每个样本`X[i]`和`y[i]`。用数学符号来表示就是我们将学`w`和`b`来预测, $$\boldsymbol{\hat{y}} = X \boldsymbol{w} + b$$ 并最小化所有数据点上的平方误差 $$\sum_{i=1}...
github_jupyter