text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Riskfolio-Lib Tutorial: <br>__[Financionerioncios](https://financioneroncios.wordpress.com)__ <br>__[Orenji](https://www.orenj-i.net)__ <br>__[Riskfolio-Lib](https://riskfolio-lib.readthedocs.io/en/latest/)__ <br>__[Dany Cajas](https://www.linkedin.com/in/dany-cajas/)__ <a href='https://ko-fi.com/B0B833SXD' target='...
github_jupyter
# Finetuning of ImageNet pretrained EfficientNet-B0 on CIFAR-100 In 2019, new ConvNets architectures have been proposed in ["EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks"](https://arxiv.org/pdf/1905.11946.pdf) paper. According to the paper, model's compound scaling starting from a 'good' ba...
github_jupyter
# Exploring precision and recall # Question 1 <img src="images/lec6_quiz01_pic01.png"> *Screenshot taken from [Coursera](https://www.coursera.org/learn/ml-classification/exam/ObhEq/exploring-precision-and-recall)* <!--TEASER_END--> # Question 2 <img src="images/lec6_quiz01_pic02.png"> *Screenshot taken from [Cou...
github_jupyter
``` # header files needed import numpy as np import torch import torch.nn as nn import torchvision from torch.utils.tensorboard import SummaryWriter from google.colab import drive drive.mount('/content/drive') np.random.seed(1234) torch.manual_seed(1234) torch.cuda.manual_seed(1234) # define transforms train_transforms...
github_jupyter
``` import os import math import tarfile import pandas as pd import numpy as np from PIL import Image import matplotlib.pyplot as plt from random import shuffle import torch from torch.utils.data import Dataset, DataLoader, random_split from torch.utils.data.sampler import SubsetRandomSampler from torchvision imp...
github_jupyter
<a href="https://colab.research.google.com/github/bkkaggle/pytorch-CycleGAN-and-pix2pix/blob/master/pix2pix.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Install ``` !git clone https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix import os o...
github_jupyter
``` import sys sys.path.append("../") import numpy as np import matplotlib.pyplot as plt import os def get_length_counts(path): counts = [] with open(path, "r") as f: for line in f: label, sentence = line.split(" ", 1) counts.append(len(sentence.replace(" ", ""))) counts = np.array(counts) retu...
github_jupyter
``` import pandas as pd import networkx as nx import matplotlib.pyplot as plt import json from collections import Mapping import os import numpy as np ``` The 18 identifiers that make health information PHI are: - Names - Dates, except year - Telephone numbers - Geographic data - FAX numbers - Social Security n...
github_jupyter
``` import coremltools %load_ext autoreload %autoreload 2 ``` ## Load pre-trained keras model ``` from keras.models import load_model # model = load_model('./model/nn4.small2.lrn.h5') import tensorflow as tf from keras.utils import CustomObjectScope with CustomObjectScope({'tf': tf}): model = load_model('./model...
github_jupyter
As the second step of this tutorial, we will train an image model. This step can be run in parallel with Step 3 (training the text model). This notebook was run on an AWS p3.2xlarge # Octopod Image Model Training Pipeline ``` %load_ext autoreload %autoreload 2 import sys sys.path.append('../../') import numpy as np...
github_jupyter
# Improving Data Quality **Learning Objectives** 1. Resolve missing values 2. Convert the Date feature column to a datetime format 3. Rename a feature column, remove a value from a feature column 4. Create one-hot encoding features 5. Understand temporal feature conversions ## Introduction Recall that machine l...
github_jupyter
### Feature Scaling - Solution With any distance based machine learning model (regularized regression methods, neural networks, and now kmeans), you will want to scale your data. If you have some features that are on completely different scales, this can greatly impact the clusters you get when using K-Means. In ...
github_jupyter
``` %load_ext watermark %watermark -p torch,pytorch_lightning,torchmetrics,matplotlib ``` The three extensions below are optional, for more information, see - `watermark`: https://github.com/rasbt/watermark - `pycodestyle_magic`: https://github.com/mattijn/pycodestyle_magic - `nb_black`: https://github.com/dnanhkhoa/...
github_jupyter
## 1. Meet Professor William Sharpe <p>An investment may make sense if we expect it to return more money than it costs. But returns are only part of the story because they are risky - there may be a range of possible outcomes. How does one compare different investments that may deliver similar results on average, but e...
github_jupyter
``` import datetime import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from sklearn.cross_validation import train_test_split from ntflib import betantf %matplotlib inline sns.set(style="white") ``` ## Defining functions for mapping and error ``` def mapper(array): array ...
github_jupyter
<a href="https://colab.research.google.com/github/stephenadhi/nn-mpc/blob/main/EVALIDASI-testing.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import sys sys.executable import os import matplotlib as mpl import matplotlib.pyplot as plt import ...
github_jupyter
``` !XLA_FLAGS=--xla_gpu_cuda_data_dir=/cm/shared/sw/pkg/devel/cuda/10.1.243_418.87.00 import jax print("jax version: ", jax.__version__) import jax.numpy as np import tensorflow_probability.substrates.jax as tfp tfd = tfp.distributions tfb = tfp.bijectors import matplotlib.pyplot as plt from scipy.linalg import toepli...
github_jupyter
``` import seaborn as sns import matplotlib.pyplot as plt import os import pandas as pd import numpy as np df=pd.read_csv("C:\\Users\\Kartik\\OneDrive\\Desktop\\python project\\15-StudentsPerformance.csv") df.head() df.dtypes plt.figure(figsize=(20,20)) _=sns.scatterplot(x = "reading score", y= "writing score", hue ...
github_jupyter
## Problem statement: Create a delinquency model which can predict in terms of a probability for each loan transaction, whether the customer will be paying back the loaned amount within 5 days of insurance of loan (Label ‘1’ & ’0’) ## Investigating the data and exploratory data analysis First installing all the li...
github_jupyter
# <div style="text-align: center">Linear Algebra for Data Scientists <div style="text-align: center">One of the most common questions we get on <b>Data science</b> is: <br> How much maths do I need to learn to be a <b>data scientist</b>? <br> If you get confused and ask experts what should you learn at this stage, mo...
github_jupyter
--- # Langages de script - Python ## Cours 8.1 — Exercices ### M2 Ingénierie Multilingue - INaLCO --- - Loïc Grobol <loic.grobol@gmail.com> - Yoann Dupont <yoa.dupont@gmail.com> ## Un peu de classe **Note** si vous modifiez des cellules pour une question, assurez vous que ça ne casse pas vos solutions pour les que...
github_jupyter
![RDD key pair](media/07.spark_statestore_files.png) --- # 06 - Lectura y escritura de ficheros -------------- ### Sistemas de ficheros soportados - Igual que Hadoop, Spark soporta diferentes filesystems: local, HDFS, Amazon S3 - En general, soporta cualquier fuente de datos que se pueda leer con Hadoop - ...
github_jupyter
<a href="https://colab.research.google.com/github/victorog17/soulcode_aulas_spark/blob/main/Soulcode_PySpark_002_select_filter.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> **BIBLIOTECAS** ``` pip install pyspark from pyspark.sql import SparkSess...
github_jupyter
# **Tiki Web Scraping with Selenium** Build a web-crawler that take in a Tiki URL and return a dataframe #Install resources ``` # install selenium and other resources for crawling data !pip install selenium !apt-get update !apt install chromium-chromedriver ### IMPORTS ### import re import time import ...
github_jupyter
# Exercises - Objects ## Using an object Below is the definition of an object. Run the cell and create at least two instances of it. ``` class Car(object): def __init__(self, make, model, year, mpg=25, tank_capacity=30.0, miles=0): self.make = make self.model = model self.year = year...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"); ##### Original code https://github.com/MokkeMeguru/glow-realnvp-tutorial/ If you have any Problem, please let me(@MokkeMeguru) it. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); ...
github_jupyter
## SVM with Kernel trick to classify flowers! As before we had issues with Logistic regression classifying Iris dataset, and we really want that trip, we will try with this Kernel trick to beat that non-linearity!! This is from the excellent reference https://scikit-learn.org/stable/auto_examples/svm/plot_iris_svc.ht...
github_jupyter
# HPV vaccination rates in Young Adults ## April 6, 2020 ## University of Utah<br>Department of Biomedical Informatics ### Monika Baker<br>Betsy Campbell<br>Simone Longo ## Introduction The <i>human papillomavirus</i> (HPV) is the most common sexually transmitted infection (STI) and affects 78 million Americans, p...
github_jupyter
# **Model** ``` experiment_label = 'SVC04_na' user_label = 'tay_donovan' ``` ## **Aim** Look for performance improvement in SVC model, by nullifying all negative values ## **Findings** Findings for this notebook ``` #Initial imports import pandas as pd import numpy as np import seaborn as sb import matplotlib.pyp...
github_jupyter
# Homework: Visualizing UFO's ## The Problem Let's go back to the UFO Dataset from earlier, remove the dataframe and add a Map! - You can start with the example from the previous unit. - Require a state to be selected. (no more selecting all states) - Remove the option to search by shape. - load a datase...
github_jupyter
``` #!pip3 install qiskit #!pip3 install pylatexenc from qiskit import * import numpy as np from scipy.stats import norm from matplotlib import pyplot as plt from scipy.stats import rv_continuous def unitary(circ,eta,phi,t): theta = np.arccos(-eta); circ.u3(theta,phi,t,0); """ get: get함수를 호출할 때마다 파라미터에 랜덤한 ...
github_jupyter
``` import pandas as pd import numpy as np import itertools from sklearn.cluster import KMeans import pprint ``` ## 1. Prepare input for node2vec > We'll use a CSV file where each row represents a single recommendable item: it contains a comma separated list of the named entities that appear in the item's title. 一个样...
github_jupyter
# voila-interactive-football-pitch This is a example widget served by `jupyter voila`. It combines `qgrid` and `bqplot` to create an interactive football pitch widget. ## Features - Selected players on the pitch are highlighted in qgrid. - Selected players selected in qgrid are marked on the pitch. - Players are moveab...
github_jupyter
``` #%matplotlib inline import datetime, math import os import numpy as np #from Scientific.IO import NetCDF import netCDF4 import matplotlib import matplotlib.pyplot as plt import spectra_mole.VIS_Colormaps as VIS_Colormaps import spectra_mole.viridis as viridis class pltRange(): def __init__(self, time=[0, -1]...
github_jupyter
### Structured Streaming with Kafka In this notebook we'll examine how to connect Structured Streaming with Apache Kafka, a popular publish-subscribe system, to stream data from Wikipedia in real time, with a multitude of different languages. #### Objectives: * Learn About Kafka * Learn how to establish a connection...
github_jupyter
``` # default_exp exp.csnc.python ``` # Data exploration (taken from CodeSearchNet challenge) ``` import json import pandas as pd from pathlib import Path pd.set_option('max_colwidth',300) from pprint import pprint import re ``` ## Preview dataset ``` !ls test_data/python ``` Download specific java dataset ``` !...
github_jupyter
``` import numpy as np #import sys #sys.path.append("../") from sklearn.svm import SVC import matplotlib.pyplot as plt import pandas as pd from sklearn.preprocessing import scale from sklearn.metrics import confusion_matrix import itertools import datetime ``` ## Loading data ### Remember that 1 means PD ``` data = p...
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 import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O...
github_jupyter
### Machine Learning for Engineers: [LongShortTermMemory](https://www.apmonitor.com/pds/index.php/Main/LongShortTermMemory) - [LSTM Networks](https://www.apmonitor.com/pds/index.php/Main/LongShortTermMemory) - Source Blocks: 10 - Description: Long-Short Term Memory (LSTM), Recurrent Neural Networks, and other sequent...
github_jupyter
``` import math import random import numpy as np import matplotlib import matplotlib.pyplot as plt from collections import namedtuple from itertools import count from PIL import Image from IPython.display import clear_output import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as ...
github_jupyter
<a href="https://colab.research.google.com/github/Tessellate-Imaging/Monk_Object_Detection/blob/master/example_notebooks/4_efficientdet/Monk%20Type%20to%20Coco%20-%20Example%202.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Installation - Run ...
github_jupyter
# DSCI 525 - Web and Cloud Computing ***Milestone 4:*** In this milestone, you will deploy the machine learning model you trained in milestone 3. Milestone 4 checklist : - [X] Use an EC2 instance. - [X] Develop your API here in this notebook. - [X] Copy it to ```app.py``` file in EC2 instance. - [X] Run your API for...
github_jupyter
<center> <img src="https://gitlab.com/ibm/skills-network/courses/placeholder101/-/raw/master/labs/module%201/images/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # **Exploratory Data Analysis Lab** Estimated time needed: **30** minutes In this module you get to work with the cleaned datase...
github_jupyter
# Scene collections - WIP Scene collections define the scenes which are used together to calculate features, such as vitual time series or . To create them we need the look up tables created in the previous notebook. **TODO**: How to properly save the scene collection such that it is easy to work with them and Snake...
github_jupyter
# LeNet Lab ![LeNet Architecture](lenet.png) Source: Yan LeCun ## Load Data Load the MNIST data, which comes pre-loaded with TensorFlow. You do not need to modify this section. ``` from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", reshape=False) X_train, y_...
github_jupyter
``` import keras keras.__version__ ``` # Deep Dream This notebook contains the code samples found in Chapter 8, Section 2 of [Deep Learning with Python](https://www.manning.com/books/deep-learning-with-python?a_aid=keras&a_bid=76564dff). Note that the original text features far more content, in particular further exp...
github_jupyter
``` # output of tool D parent_folder = '/Users/kavyasrinet/Desktop/other_actions/0/' folder_name_D = parent_folder + 'toolD/' tool_D_out_file = folder_name_D + 'all_agreements.txt' # output of tool C parent_folder= '/Users/kavyasrinet/Desktop/other_actions/5/' folder_name_C = parent_folder + 'toolC/' tool_C_out_file =...
github_jupyter
``` import bioformats import deepdish as dd import h5py import javabridge import numpy as np import os.path from pyprind import prog_percent import SimpleITK as sitk import tables import time from xml.etree import ElementTree as ETree # https://stackoverflow.com/questions/40845304/runtimewarning-numpy-dtype-size-chang...
github_jupyter
# Interacting with Ethereum using web3.py and Jupyter Notebooks Step by step guide for setting up a Jupyter notebook, connecting to an Ethereum node and working with a Smart Contract. In this tutorial we are using Python 3, so make sure that **python** and **pip** are versioned correctly. <hr> ## STEP 0: Getting tuto...
github_jupyter
<img src="https://github.com/pmservice/ai-openscale-tutorials/raw/master/notebooks/images/banner.png" align="left" alt="banner"> # Working with Watson Machine Learning This notebook should be run using with **Python 3.7.x** runtime environment. **If you are viewing this in Watson Studio and do not see Python 3.7.x in...
github_jupyter
# The Red Line Problem Think Bayes, Second Edition Copyright 2020 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/) ``` # If we're running on Colab, install empiricaldist # https://pypi.org/project/empiricaldist/ ...
github_jupyter
``` import numpy as np import mxnet as mx import time import pandas as pd import cv2 import logging logging.getLogger().setLevel(logging.DEBUG) # logging to stdout import matplotlib.pyplot as plt %matplotlib inline # Load the trained model # img_w, img_h = 200, 200 # checkpoint = 210 img_w, img_h = 64, 64 checkpoint...
github_jupyter
# Categorical Data Plots Now let's discuss using seaborn to plot categorical data! There are a few main plot types for this: * factorplot * boxplot * violinplot * stripplot * swarmplot * barplot * countplot ``` import seaborn as sns import numpy as np import pandas as pd %matplotlib inline tips = sns.load_dataset('t...
github_jupyter
# Projecting conflict risk In this notebook, we will show how CoPro uses a number of previously fitted classifiers and projects conflict risk forward in time. Eventually, these forward predictions based on multiple classifiers can be merged into a robust estimate of future conflict risk. ## Preparations Start with l...
github_jupyter
# State Machines in Python — Part 1 ### Check Installation Run the following cell by clicking `Shift` + `Enter`. It should output the current version of stmpy you have installed. ``` import stmpy print('STMPY Version installed: {}'.format(stmpy.__version__)) ``` If you haven't installed stmpy, install it via the fo...
github_jupyter
# Welcome to Safran Lab 1 Every day, more than 80,000 commercial flights take place around the world, operated by hundreds of airlines. For all aircraft take-off weight exceeding 27 tons, a regulatory constraint requires companies to systematically record and analyse all flight data, for the purpose of improving the...
github_jupyter
``` from math import floor import torch import torch.nn as nn import numpy as np import matplotlib.pyplot as plt from src.LinearSimulator import Simulator, SimpleSSM from src.control.SimpleMPC import MPC from src.utils import set_seed ``` ## Setup simulator and model ``` device = 'cpu' set_seed(seed=0, use_cuda=Fa...
github_jupyter
## Import libraries ``` import logging from typing import Optional, Tuple import numpy as np import pandas as pd import lightgbm as lgb from catboost import CatBoostClassifier, Pool from sklearn import metrics # https://github.com/roelbertens/time-series-nested-cv/blob/master/time_series_cross_validation/custom_time_...
github_jupyter
### Preparation steps Install iotfunctions with `pip install git+https://github.com/ibm-watson-iot/functions@dev` This projects contains the code for the Analytics Service pipeline as well as the anomaly functions and should pull in most of this notebook's dependencies. The plotting library matplotlib is the except...
github_jupyter
``` import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) from pathlib import Path import os DATA_DIR=Path('../data/influence') for dirname, _, filenames in os.walk(DATA_DIR): for filename in filenames: print(os.path.join(dirname, filename)) TRAIN_PATH = ...
github_jupyter
``` #load watermark %load_ext watermark %watermark -a 'Gopala KR' -u -d -v -p watermark,numpy,pandas,matplotlib,nltk,sklearn,tensorflow,theano,mxnet,chainer,seaborn,keras,tflearn,bokeh,gensim import keras keras.__version__ ``` # A first look at a neural network This notebook contains the code samples found in Chapter...
github_jupyter
**Copyright 2019 The TensorFlow Authors**. Licensed under the Apache License, Version 2.0 (the "License"). # Generating Handwritten Digits with DCGAN <table class="tfo-notebook-buttons" align="left"> <td> <a target="_blank" href="https://www.tensorflow.org/alpha/tutorials/generative/dcgan.ipynb"> <img src=...
github_jupyter
# Detectron2 training notebook Based on the [official Detectron 2 tutorial]( https://colab.research.google.com/drive/16jcaJoc6bCFAQ96jDe2HwtXj7BMD_-m5) This is a notebook that can generate the model used for the image segmentation. It is intended to be used on google colab, but can easily be changed to run locally. T...
github_jupyter
# More Feature Engineering - Wide and Deep models **Learning Objectives** * Build a Wide and Deep model using the appropriate Tensorflow feature columns ## Introduction In this notebook we'll use what we learned about feature columns to build a Wide & Deep model. Recall, that the idea behind Wide & Deep model...
github_jupyter
## Facies classification using Machine Learning #### Joshua Poirier, NEOS Let's take a different approach from traditional machine learning algorithms. Something simple. For each **test** observation, I will cross-correlate it (and surrounding observations - a log section) against all log sections in the **train**...
github_jupyter
<a href="https://colab.research.google.com/github/ChamaniS/ANN-exercises/blob/master/HAR_using_CNN_%26_LSTM.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('/content/gdrive') import numpy as np import k...
github_jupyter
<h1 align = center><font size = 5>Image Procesing With Python(Matplotlib,Numpy and OpenCV)<font/></h1> <h1>Introduction!</h1> <h3>Welcome</h3> <p>int this section, you will learn how to obtain the histogram from image, do normalization to image intesities, calculate cumulative histogram. By the end of this lab you wil...
github_jupyter
# Interrupted Time Series Analysis - Time Series with control (in R) ``` library(nlme) library(car) library(tseries) library(ggplot2) library(lmtest) library(LSTS) library(data.table) data <- read.csv(file="data/gp.csv", header=TRUE, sep=",") nrow(data) # expecting 74 weeks data$diff <- data$rate_attend_control - data...
github_jupyter
# Identifying Complexes in your Network of Protein-Protein Interactions **Contact: ** - http://github.com/cokelaer - http://thomas-cokelaer.info **Date:** Feb 2015 ## Introduction The assumption is that you have a network of protein-protein interactions, from which you know the protein names by their uniprot a...
github_jupyter
``` import numpy as np np.random.seed(1337) import matplotlib.pyplot as plt x, y, z = np.random.randn(3,10,2) x.shape, y.shape, z.shape plt.scatter(*x.T, c="r", label="x") plt.scatter(*y.T, c="g", label="y") plt.scatter(*z.T, c="b", label="z") plt.legend() plt.scatter(*(x/np.linalg.norm(x,axis=1,keepdims=True)).T, c="...
github_jupyter
# Expungability Hypothetical: Elimination of Petition Eligibility (Converting Petition to Automatic) ``` import sqlalchemy as sa from sqlalchemy import create_engine import psycopg2 as db import pandas as pd import numpy as np import os from matplotlib import pyplot as plt import matplotlib.ticker as ticker import sea...
github_jupyter
<a href="https://colab.research.google.com/github/ornob39/Python_For_DataScience_AI-IBM/blob/master/Python_For_DSandAI_5_1_Numpy1D.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <div class="alert alert-block alert-info" style="margin-top: 20px"> ...
github_jupyter
## Compare the assemblies in GenBank, GTDB, and RAST Each has a different set. What are the unions and intersections? ``` # A lot of this is not used, but we import it so we have it later! import os import sys import matplotlib.pyplot as plt import matplotlib.ticker as mticker import pandas as pd import seaborn as sn...
github_jupyter
# Autonomous driving - Car detection Welcome to your week 3 programming assignment. You will learn about object detection using the very powerful YOLO model. Many of the ideas in this notebook are described in the two YOLO papers: [Redmon et al., 2016](https://arxiv.org/abs/1506.02640) and [Redmon and Farhadi, 2016](h...
github_jupyter
# Extract features from clauses and sentences that need citations and those that do not Author: Kiran Bhattacharyya Revision: 5/11/18 - DRM - translate .py files into .ipynb, misc formatting this code reads in two data files: 1. one contains sentences and clauses that need citations 2. the other contains sentences...
github_jupyter
# Generate class weights pickle array ### Generate class weights array based on classes histogram ``` import sys; print('Python:',sys.version) import torch; print('Pytorch:',torch.__version__) import fastai; print('Fastai:',fastai.__version__) from fastai.basics import * from fastai.callback.all import * from fastai....
github_jupyter
# Modeling TRISO Particles OpenMC includes a few convenience functions for generationing TRISO particle locations and placing them in a lattice. To be clear, this capability is not a stochastic geometry capability like that included in MCNP. It's also important to note that OpenMC does not use delta tracking, which wou...
github_jupyter
``` # Import libraries for simulation import tensorflow as tf import numpy as np dimensions = (12,12) mineProbability = 0.2 # count the number of mines in the proximity of given square, including square itself def countMines(board,r,c): count = 0 rows, cols = board.shape for i in [r-1,r,r+1]: if i >...
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
# Entanglement renormalization One can open this notebook in Google Colab (is recommended) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/LuchnikovI/QGOpt/blob/master/docs/source/entanglement_renormalization.ipynb) In the given tutorial, we show ...
github_jupyter
# Analysis notebook Author: Evan Azevedo Company: Amberdata Blog Post: Large Txn's in the Mempool ``` # loading the packages import os import json import requests from tqdm import tqdm from datetime import datetime, timedelta, timezone import pytz import matplotlib.pyplot as plt import pandas as pd import numpy as...
github_jupyter
``` __author__ = 'Guillermo Damke <gdamke@gmail.com>, Francisco Förster <francisco.forster@gmail.com>, Alice Jacques <alice.jacques@noirlab.edu>' __version__ = '20210119' # yyyymmdd; __datasets__ = ['Iris flower dataset'] __keywords__ = ['Introduction to Machine Learning', 'Supervised Machine Learning', 'La Serena Scho...
github_jupyter
## Data Mining and Machine Learning ### Logistic Regression ### Libraries: scikit-learn and h2o #### Edgar Acuna #### Marzo 2021 ``` import numpy as np import pandas as pd from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn.preprocessing import Standa...
github_jupyter
<table border="0"> <tr> <td> <img src="https://ictd2016.files.wordpress.com/2016/04/microsoft-research-logo-copy.jpg" style="width 30px;" /> </td> <td> <img src="https://www.microsoft.com/en-us/research/wp-content/uploads/2016/12/MSR-ALICE-HeaderGraphic-1920x720_...
github_jupyter
``` import numpy as np import pandas as pd from matplotlib import pyplot as plt from tqdm import tqdm %matplotlib inline from torch.utils.data import Dataset, DataLoader import torch import torchvision import torch.nn as nn import torch.optim as optim from torch.nn import functional as F device = torch.device("cuda" i...
github_jupyter
``` from IPython.display import Image from IPython.core.display import HTML ``` # Tervetuloa kurssille johdatus datatieteeseen Tiedot kurssin suorittamisesta löytyy <a href="https://jodatut.github.io/2019/">GitHub:sta</a> Kurssin luennoijana toimii <a href="https://www.linkedin.com/in/arhosuominen/">Arho Suominen</a...
github_jupyter
``` #cell-width control from IPython.core.display import display, HTML display(HTML("<style>.container { width:80% !important; }</style>")) ``` # Imports ``` #packages import numpy import tensorflow as tf from tensorflow.core.example import example_pb2 #utils import os import random import pickle import struct impor...
github_jupyter
# Scripts for the analysis in the paper ``` import sys import os import datetime import matplotlib.pyplot as plt import numpy as np import pandas as pd import scipy.stats as stats import seaborn as sns from matplotlib.ticker import FuncFormatter from seaborn.algorithms import bootstrap from seaborn.utils import ci nb_...
github_jupyter
``` import tensorflow as tf import numpy as np import tictactoe as ttt function_approx = ttt.DNN_Random_Walk(N_A=2) N_S = 5 N_A = 2 N_episodes = 10 optimizer = tf.keras.optimizers.Adam() random_walk_env = ttt.RandomWalkEnv() function_approx = ttt.DNN_Random_Walk(N_A=N_A) for _ in range(N_episodes): S = random_walk...
github_jupyter
<a href="https://colab.research.google.com/github/kevincong95/cs231n-emotiw/blob/master/notebooks/2.4-tj-la-ak-kc-vl-FINAL-ensemble_fc_predictions.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Video Sentiment Analysis in the Wild Ensembling Not...
github_jupyter
### OCI Data Science - Useful Tips <details> <summary><font size="2">Check for Public Internet Access</font></summary> ```python import requests response = requests.get("https://oracle.com") assert response.status_code==200, "Internet connection failed" ``` </details> <details> <summary><font size="2">Helpful Document...
github_jupyter
## Lecture 2: Models of Computation Lecture by Erik Demaine Video link here: [https://www.youtube.com/watch?v=Zc54gFhdpLA&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb&index=2](https://www.youtube.com/watch?v=Zc54gFhdpLA&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb&index=2) ### Problem statement: Given two documents, **D1** a...
github_jupyter
# Evaluation of a QA System [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack/blob/master/tutorials/Tutorial5_Evaluation.ipynb) To be able to make a statement about the performance of a question-answering system, it is important t...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#VITS-Attentions" data-toc-modified-id="VITS-Attentions-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>VITS Attentions</a></span></li></ul></div> ``` # default_exp models.attentions ``` # VITS Attention...
github_jupyter
``` import torch import json import h5py import numpy as np from matplotlib.pyplot import imshow from PIL import Image, ImageDraw project_dir = '[Your Project Path]' image_file = json.load(open(f'{project_dir}/datasets/vg/image_data.json')) vocab_file = json.load(open(f'{project_dir}/datasets/vg/VG-SGG-dicts.json')) da...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as ply import seaborn as sns import os from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import train_test_split, KFold, cross_val_score from sklearn.metrics import mean_absolute_error from sklearn.impute import KNNImpute...
github_jupyter
## Data : --> Date (date the crash had taken place) --> Time (time the crash had taken place) --> Location --> Operator --> Flight --> Route --> Type --> Registration --> cn/In - ? --> Aboard - number of people aboard --> Fatalities - lethal outcome --> Ground - saved people --> Su...
github_jupyter
``` from IPython.core.display import HTML HTML('''<style> .container { width:100% !important; } </style> ''') ``` # How to Check that a Formula is a Tautology In this notebook we develop a function <tt>tautology</tt> that takes a formula $f$ from propositional logic and checks whether $f$ is a ta...
github_jupyter
# Section: Encrypted Deep Learning - Lesson: Reviewing Additive Secret Sharing - Lesson: Encrypted Subtraction and Public/Scalar Multiplication - Lesson: Encrypted Computation in PySyft - Project: Build an Encrypted Database - Lesson: Encrypted Deep Learning in PyTorch - Lesson: Encrypted Deep Learning in Keras - Fina...
github_jupyter
# CAT10 BAYESIAN :D :D :D :D :D ``` import sys from skopt import gp_minimize from skopt.space import Real, Integer from utils.post_processing import eurm_to_recommendation_list,eurm_remove_seed, shift_rec_list_cutoff from utils.pre_processing import norm_max_row, norm_l1_row from utils.evaluator import Evaluator fro...
github_jupyter