text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
### Average Precision for test data #### Import data ``` import pandas as pd import numpy as np import os import glob import matplotlib.pyplot as plt %matplotlib inline pd.options.display.float_format = "{:,.4f}".format final_dir = "/scratch/jag2j/final_data/" os.chdir(final_dir) os.listdir() result_list = glob.glob...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
## AmExpert 2021 โ€“ Machine Learning Hackathon ### Problem Statement * A mid-sized private bank that includes a variety of banking products, such as savings accounts, current accounts, investment products, credit products, and home loans. * The task is to predict the next set of products (upto 3 products) for a set of...
github_jupyter
``` %matplotlib inline ``` ์‚ฌ์šฉ์ž ์ •์˜ Dataset, Dataloader, Transforms ์ž‘์„ฑํ•˜๊ธฐ ========================================================== **์ €์ž** : Sasank Chilamkurthy <https://chsasank.github.io> **๋ฒˆ์—ญ** : ์ •์œค์„ฑ <https://github.com/Yunseong-Jeong> ๋จธ์‹ ๋Ÿฌ๋‹ ๋ฌธ์ œ๋ฅผ ํ‘ธ๋Š” ๊ณผ์ •์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ค€๋น„ํ•˜๋Š”๋ฐ ๋งŽ์€ ๋…ธ๋ ฅ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. PyTorch๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ๊ณผ์ •์„ ์‰ฝ๊ฒŒํ•ด์ฃผ๊ณ , ๋˜ ์ž˜ ์‚ฌ์šฉํ•œ...
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
<a href="https://colab.research.google.com/github/gumdropsteve/intro_to_python/blob/main/day_02/intro_to_python.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Intro to Python Intro to Python, day 2. ## Variables ``` a = 'this is a string' ...
github_jupyter
``` from __future__ import absolute_import from __future__ import division from __future__ import print_function import functools import os import tensorflow as tf print(tf.__version__) import boto3 from sagemaker import get_execution_role tf.compat.v1.enable_eager_execution() import utils import data import extract...
github_jupyter
``` import tensorflow as tf import random import numpy as np import matplotlib.pyplot as plt %matplotlib inline from __future__ import absolute_import from __future__ import print_function import numpy as np import numpy import PIL from PIL import Image np.random.seed(1337) # for reproducibility import random from ke...
github_jupyter
<a href="https://colab.research.google.com/github/Educat8n/Reinforcement-Learning-for-Game-Playing-and-More/blob/main/Module3/Module_3.3_Application_of_RL_in_Finance_TensorTrader_example.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Install Tens...
github_jupyter
# Interacting with Python __Content modified under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License ยฉ 2020 R.C. Cooper__ These notebooks are a combination of original work and modified notebooks from [Engineers Code](https://github.com/engineersCode/EngComp.git) learning modules. The le...
github_jupyter
``` from scipy import stats import scipy import matplotlib.pyplot as plt import pandas as pd import math """ Precificaรงรฃo utilizando Black and Scholes. cp: +1 -> call; -1 put s: valor da aรงรฃo k: strike t: tempo em dias atรฉ expirar a opรงรฃo v: volatilidade rf: taxa de juros neutra risco """ def bl...
github_jupyter
``` import pickle import numpy as np import matplotlib import matplotlib.pyplot as plt import os from scipy.stats import pearsonr ``` # Load Data ``` # test order = pickle.load(open('C:/Users/Vanda/PycharmProjects/dense/results/nppmi/order/glove.6B.400k.300d.txt_f_conceptnet56_top50000_base_order.p', 'rb')) map_c = p...
github_jupyter
# Classification using Stochastic Gradient Descent ### Dr. Tirthajyoti Sarkar, Fremont, CA 94536 In this notebook, we show the application of Stochastic Gradient Descent for classification problems. **This is particularly useful compared to some other popular classifiers like Random Forest as the training dataset and ...
github_jupyter
# Bert NER on SageMaker using PyTorch This uses the Biocreative II gene mention dataset https://biocreative.bioinformatics.udel.edu/tasks/biocreative-ii/task-1a-gene-mention-tagging/ ``` import sys, os import logging sys.path.append("src") logging.basicConfig(level="INFO", handlers=[logging.StreamHandler(sys.stdout...
github_jupyter
# [deplacy](https://koichiyasuoka.github.io/deplacy/) per l'analisi sintattica ## con [NLP-Cube](https://github.com/Adobe/NLP-Cube) ``` !pip install deplacy nlpcube from cube.api import Cube nlp=Cube() nlp.load("it") doc=nlp("Chi non beve in compagnia o รจ un ladro o รจ una spia.") import deplacy deplacy.render(doc) de...
github_jupyter
# scona scona is a tool to perform network analysis over correlation networks of brain regions. This tutorial will go through the basic functionality of scona, taking us from our inputs (a matrix of structural regional measures over subjects) to a report of local network measures for each brain region, and network le...
github_jupyter
# DocTable Schemas Your database table column names and types come from a schema class defined using the `@doctable.schema` decorator. In addition to providing a schema definition, this class can be used to encapsulate data when inserting or retrieving from the database. At its most basic, your schema class operates ...
github_jupyter
# Persistence model You remember your professor of the Time Series class. Don't build a crazy model before trying with persistence. A baseline is always valuable: sometimes it provides good enough results, but it always sets the level for more complex approaches. <div class="alert alert-block alert-warning"> <b>Sim...
github_jupyter
# Comparison of the accuracy of a cutting plane active learning procedure using the (i) analytic center; (ii) Chebyshev center; and (iii) random center on the diabetes data set # The set up ``` import numpy as np import pandas as pd import active import experiment import logistic_regression as logr from sklearn impor...
github_jupyter
# Video Actor Synchroncy and Causality (VASC) ## RAEng: Measuring Responsive Caregiving Project ### Caspar Addyman, 2020 ### https://github.com/infantlab/VASC # Step 3: Analyse the data using scipy statsmodels This script correlates and compares the timeseries of wireframes for the two figures in the video `["parent"...
github_jupyter
<a href="http://cocl.us/pytorch_link_top"> <img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/DL0110EN/notebook_images%20/Pytochtop.png" width="750" alt="IBM Product " /> </a> <img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/DL0110EN...
github_jupyter
``` # importing the necessary packages import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns from sklearn import metrics from sklearn.cluster import KMeans from sklearn.datasets import load_digits from sklearn.decomposition import PCA from sklearn.preprocessing import scale tracks...
github_jupyter
# UART Demo This demo highlights the usefulness of using a more complex MMIO driver wrapper by implementing a wrapper to interact with UART hardware. This wrapper is included in the notebook as an example of how to create a more complicated MMIO driver, including how to interact with interrupts. ``` import asyncio, t...
github_jupyter
``` from IPython.core.display import display, HTML display(HTML("<style>.container { width:85% !important; }</style>")) %load_ext autoreload import os import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.python.client import device_lib from tensorflow.keras import layers,models,util...
github_jupyter
# Fit the DDM on individual data ``` import rlssm import pandas as pd import os ``` ## Import the data ``` data = rlssm.load_example_dataset(hierarchical_levels = 1) data.head() ``` ## Initialize the model ``` model = rlssm.DDModel(hierarchical_levels = 1) ``` ## Fit ``` # sampling parameters n_iter = 1000 n_ch...
github_jupyter
The problem statement I am interested in is: **predicting the publisher's name from a given title**. For approaching this problem, first I am going to need a dataset consisting of article/post titles with their sources mentioned. The dataset I am going to use is already there as a BigQuery public dataset ([link](http...
github_jupyter
##### Copyright 2020 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
<div class="alert alert-block alert-info"> <h1 style='color:black'>Python for beginners</h1> <h1><i>Software WG tutorial at CNS*2021</i></h1> </div> <div class="alert alert-block alert-warning"> <h2 style='color:black'>Part 1: Virtual environments and Python package installation</h2> </div> ### Using virt...
github_jupyter
## Convergence Testing: ### K-Point Convergence: Using a plane-wave energy cutoff of 520 eV, and Monkhorst pack k-grid densities of $i$ x $i$ x $i$ for $i$ ranging from 1 to 8. ``` import numpy as np import matplotlib.pyplot as plt kdensity = np.arange(3, 8.1) kconv_energies = np.array([float(line.rstrip('\n')) ...
github_jupyter
# Chaper 8 - Intrinsic Curiosity Module #### Deep Reinforcement Learning *in Action* ##### Listing 8.1 ``` import gym from nes_py.wrappers import JoypadSpace #A import gym_super_mario_bros from gym_super_mario_bros.actions import SIMPLE_MOVEMENT, COMPLEX_MOVEMENT #B env = gym_super_mario_bros.make('SuperMarioBros-v0'...
github_jupyter
# Flow in a nano-porous material In this notebook we'll explore flow induced in a nano-porous material. To do this we introduce a force $\mathbf{F}_x$ acting on each particle $i$ in the nano-porous material. In the case of a gravitational field, we can formulate Darcy's law for flow as \begin{align} \mathbf{U} = \...
github_jupyter
<a href="https://colab.research.google.com/github/SamuelLawrence876/Jamaica-stock-exchange-quantative-analysis/blob/master/Quantitative_analysis_with_the_JSE.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # This notebook serves as an introuction in...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # Creating and Updating a Docker Image before Deployment as a Webservice This notebook demonstrates how to make changes to an existing docker image, before deploying it as a webservice. Knowing how to do this can be helpful,...
github_jupyter
``` import argparse import copy import json import os import sys try: import apex except: print("No APEX!") import numpy as np import torch from torch import nn import yaml from det3d import torchie from det3d.datasets import build_dataloader, build_dataset from det3d.models import build_detector from det3d.to...
github_jupyter
# CMAES : Covariance Matrix Adaptation Evolutionary Strategy Setup code and utility functions to plot and explore ``` import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors from matplotlib import cm from mpl_toolkits.mplot3d import axes3d from numpy.random import multivariate_normal im...
github_jupyter
# Plotting and typesetting The following are functions for plotting and typesetting. ``` %pylab inline import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D font = {'size': 12} plt.rc('font', **font) # Function for creating a surface plot. def plot3d(f,lim=(-5,5),title='Surface plot',detail=0.05, ...
github_jupyter
# Model Optimization with an Image Classification Example 1. [Introduction](#Introduction) 2. [Prerequisites and Preprocessing](#Prequisites-and-Preprocessing) 3. [Train the model](#Train-the-model) ## Introduction *** Welcome to our model optimization example for image classification. In this demo, we will use the ...
github_jupyter
# M11. Binary Representation I've so far deferred any exposition of the binary system, mostly for reasons which come down to expedience. There is nothing remarkable about positional notation, much less its specific manifestation in base 2 (which is all binary really is). It's only on two counts that I'll qualify the...
github_jupyter
# BERT Transformer Classifier ### with HuggingFace and Tensorflow 2 ``` # slient install !pip install -q -r requirements.txt # all imports import os, time from datetime import datetime from tqdm.notebook import trange, tqdm import requests import europy from europy.notebook import load_global_params from europy.decor...
github_jupyter
``` ! pip install transformers # ! pip install scipy sklearn # ! pip install farasapy # ! pip install pyarabic # ! git clone https://github.com/UBC-NLP/marbert # ! git clone https://github.com/aub-mind/arabert ! pip install datasets # ! pip install huggingface_hub # ! apt install git-lfs # ! git config --global user.em...
github_jupyter
<a href="https://colab.research.google.com/github/Shantanu9326/Data-Science-Portfolio/blob/master/911_Calls_Project.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # 911 Calls Capstone Project For this capstone project we will be analyzing some 911...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
``` 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
``` import os import numpy as np import ipywidgets as widgets from glmtools.io.glm import GLMDataset from datetime import datetime, timedelta from glmtools.test.common import get_sample_data_path sample_path = get_sample_data_path() samples = [ "OR_GLM-L2-LCFA_G16_s20181830433000_e20181830433200_c20181830433231.nc...
github_jupyter
Copyright 2019 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed...
github_jupyter
# Machine Learning and Topological Data Analysis Mathieu Carriรจre, https://mathieucarriere.github.io/website/ ``` import numpy as np import gudhi as gd import gudhi.representations import matplotlib.pyplot as plt ``` In this notebook, we will see how to efficiently combine machine learning and topological data analy...
github_jupyter
This notebook was prepared by [wdonahoe](https://github.com/wdonahoe). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges). # Challenge Notebook ## Problem: Implement a function that groups identical items based on their order in the list. * [Constraints](#Constraints...
github_jupyter
# Transfer Learning *by Marvin Bertin* <img src="../images/keras-tensorflow-logo.jpg" width="400"> # Using Transfer Learning to Train an Image Classification Model Deep learning allows you to learn features automatically from the data. In general this requires a lot of training examples, especially for problems wher...
github_jupyter
# Introduction to CT In this exercise sheet we will get to know the Computed Tomography reconstruction problem ## Load Data ``` import torch import matplotlib.pyplot as plt from torchvision import datasets, transforms %matplotlib inline batch_size = 4 # datasets (MNIST) transform_test = transforms.Compose([ tr...
github_jupyter
<a href="https://colab.research.google.com/github/amandaleonel/deep-learning-v2-pytorch/blob/master/intro-to-pytorch/Part%202%20-%20Neural%20Networks%20in%20PyTorch%20(Exercises).ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neural networks with...
github_jupyter
# ้‡ๅญใƒ•ใƒผใƒชใ‚จๅค‰ๆ› ๅคๅ…ธ็š„ใชใƒ•ใƒผใƒชใ‚จๅค‰ๆ›ใฏๆณขใ‚„ไฟกๅทใฎ่งฃๆžใซใŠใ„ใฆ้‡่ฆใชใƒ„ใƒผใƒซใงใ‚ใ‚Šใ€้–ขๆ•ฐใ‚’ใใ‚Œใžใ‚Œ็•ฐใชใ‚‹ๅ‘จๆณขๆ•ฐใ‚’ๆŒใคๆˆๅˆ†ใซๅˆ†่งฃใ—ใพใ™ใ€‚ ใ“ใฎ้›ขๆ•ฃ็š„ใชๅฏพๅฟœใงใ‚ใ‚‹้›ขๆ•ฃใƒ•ใƒผใƒชใ‚จๅค‰ๆ›ใฏใ€$n$ ๅ€‹ใฎ่ค‡็ด ๆ•ฐ $x_0,\ldots,x_{N-1}$ ใซไฝœ็”จใ—ใ€ๆฌกๅผใฎใ‚ˆใ†ใซใ€ๅˆฅใฎ $n$ ๅ€‹ใฎ่ค‡็ด ๆ•ฐๅˆ— $\tilde x_0,\ldots,\tilde x_{N-1}$ ใธใจๅค‰ๆ›ใ—ใพใ™ใ€‚ $$\tilde x_k = \sum_{y=0}^{N-1}e^{-\frac{2\pi ikn}N} \cdot x_k$$ $n$ ๅ€‹ใฎ้‡ๅญใƒ“ใƒƒใƒˆใซๅฏพใ™ใ‚‹้‡ๅญใƒ•ใƒผใƒชใ‚จๅค‰ๆ›๏ผˆไธ€่ˆฌใซQFTใจ็•ฅใ—ใพใ™๏ผ‰ใฏๅ„ๅŸบๅบ•็Šถๆ…‹ $x\in \{0,1\}^n$ ...
github_jupyter
# Implementing FIR filters <div align="right"><a href="https://people.epfl.ch/paolo.prandoni">Paolo Prandoni</a>, <a href="https://www.epfl.ch/labs/lcav/">LCAV, EPFL</a></div> <br /> Digital filters are fully described by their constant-coefficient difference equation (CCDE) and a CCDE can be easily translated into a ...
github_jupyter
``` import sys sys.path.append('../') import soynlp print(soynlp.__version__) ``` soynlp 0.0.46+ ์—์„œ๋Š” soynlp.noun.LRNounExtractor ๋ฅผ ๋ณด์™„ํ•œ LRNounExtractor_v2 ๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. version 2 ์—์„œ๋Š” (1) ๋ช…์‚ฌ ์ถ”์ถœ์˜ ์ •ํ™•์„ฑ์„ ๋†’์˜€์œผ๋ฉฐ, (2) ํ•ฉ์„ฑ๋ช…์‚ฌ์˜ ์ธ์‹์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ (3) ๋ช…์‚ฌ์˜ ๋นˆ๋„๋ฅผ ์ •ํ™•ํžˆ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ๋ฒ•์€ version 1 ๊ณผ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค. train_extract ํ•จ์ˆ˜๋ฅผ ํ†ตํ•˜์—ฌ ๋ช…์‚ฌ ์ ์ˆ˜๋ฅผ ๊ณ„์‚ฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. verb...
github_jupyter
# Imports ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import patches,patheffects import torch from torchvision import datasets,transforms,models from torch import nn import torch.nn.functional as F from torch.utils.data import DataLoader , Dataset import torchvision.tran...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy import stats import seaborn as sns import scipy.stats as ss from pandas_datareader import DataReader from datetime import datetime # Make plots larger plt.rcParams['figure.figsize'] = (15, 9) facebook = DataReader('FB', 'yahoo', dat...
github_jupyter
# **Load Data** ``` #mount google drive home directory from google.colab import drive drive.mount('/gdrive') %cd /gdrive #data analysis and visualization import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.pylab as pylab import seaborn as sns from pandas.plotting import scatter_mat...
github_jupyter
<a href="https://colab.research.google.com/github/kalz2q/mycolabnotebooks/blob/master/arabictable.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` #@title %%html <style> table { border-collapse: collapse; border: 2px solid rgb(200, 200,...
github_jupyter
# LFPCA through all conditions of anesthetized monkey to run the monkey data through the analysis pipeline <br> eyes open, eyes closed, and anesthesized <br> write the code such that running through the notebook ONCE will reproduce all the results for all 3 datasets visualize the results and compare the different con...
github_jupyter
# Driver Assist Machine Learning Using RCNN-Masking ### What is Mask R-CNN: - R-CNN stands for "Regions with CNN features", CNN stands for "Convolutional Neural Network". - R-CNN grabs parts of an image (or region) as a bounding box, and computes each region for CNN features, it then classifies each region to determ...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import graspy as gp res_df1 = pd.read_csv("../results/20200305_adj_row_wise.csv") res_df1 = res_df1[res_df1.delta != 0] res_df1 = res_df1.sort_values(['m', 'delta']) res_df1 = res_df1[res_df1.m <= 250] res_df = pd.read_csv...
github_jupyter
``` import os import numpy as np import pandas as pd #from datetime import datetime, timedelta import datetime import xarray as xr #from math import atan2, log import sys import uuid import matplotlib.pyplot as plt import seawater as sw import cartopy.crs as ccrs # import projections import cartopy.f...
github_jupyter
### You are looking at data from an e-commerce website. The site is very simple and has just 4 pages: #### The first page is the home page. When you come to the site for the first time, you can only land on the home page as a first page. #### From the home page, the user can perform a search and land on the search pa...
github_jupyter
<a href="https://colab.research.google.com/github/google/applied-machine-learning-intensive/blob/master/content/04_classification/08_video_processing_project/colab.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #### Copyright 2020 Google LLC. ``` ...
github_jupyter
<center> <h1><b>Word Embedding Based Answer Evaluation System for Online Assessments (WebAES)</b></h1> <h3>A smart system to automate the process of answer evaluation in online assessments.</h3> <h5> LDA + BERT Model for WebAES</h5> ``` # To perform text pre-processing import string # Natural Language Toolkit import ...
github_jupyter
``` import numpy as np import os import matplotlib.pyplot as plt %matplotlib inline from PIL import Image from scipy.stats import truncnorm import cv2 import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from torch.utils.data.sampler import SubsetRandomSampler impo...
github_jupyter
``` %matplotlib inline import numpy as np import pandas as pd import math from scipy import stats import pickle from causality.analysis.dataframe import CausalDataFrame from sklearn.linear_model import LinearRegression import datetime import matplotlib import matplotlib.pyplot as plt import matplotlib.font_manager as f...
github_jupyter
# SUYASH PRATAP SINGH # NUMPY OPERATIONS ``` # Import Numpy Library import numpy as np import warnings warnings.filterwarnings("ignore") from IPython.display import Image ``` # Numpy Array Creation ``` list1 = [10,20,30,40,50,60] list1 # Display the type of an object type(list1) #Convert list to Numpy Array arr1 = ...
github_jupyter
``` from collections import Counter from collections import defaultdict import functools from IPython.display import set_matplotlib_formats import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import skimage from skimage import io %matplotlib inline set_matplotlib_formats('svg'...
github_jupyter
``` from database.strategy import Strategy from database.sec import SEC from database.market import Market from transformer.model_transformer import ModelTransformer from transformer.product_transformer import ProductTransformer from transformer.predictor_transformer import PredictorTransformer from preprocessor.model_...
github_jupyter
# Data Processing and Analysis Data Processing is the most important and most time consuming component of the overall lifecycle of any Machine Learning project. In this notebook, we will analyze a dummy dataset to understand different issues we face with real world datasets and steps to handle the same. ## Utilitie...
github_jupyter
``` # default_exp numpy ``` # 00_Numpy > Building an example `Dataset` and `DataLoader` with `NumPy` ``` #hide from nbdev.showdoc import * #export from fastai2.tabular.all import * ``` For our data we'll first utilize `TabularPandas` for pre-processing. One potential is to use `TabularPandas` for pre-processing onl...
github_jupyter
# ะกะฟั€ะฐะฒะบะฐ API Cross Web ะพััƒั‰ะตัั‚ะฒะปัะตั‚ ั€ะฐัั‡ะตั‚ ะดะฐะฝะฝั‹ั… ะฟั€ะพะตะบั‚ะฐ Cross Web (ะธะทะผะตั€ะตะฝะธะต ะฐัƒะดะธั‚ะพั€ะธะธ ะฒ ะธะฝั‚ะตั€ะฝะตั‚ะต). ะžะฑั€ะฐั‰ะฐั‚ัŒัั ะบ API Cross Web ะฑัƒะดะตะผ ั ะฟะพะผะพั‰ัŒัŽ Jupyter Notebook, ะดะปั ัั‚ะพะณะพ ะฝะตะพะฑั…ะพะดะธะผะพ ะฒะปะฐะดะตั‚ัŒ ะฝะตะบะพั‚ะพั€ั‹ะผะธ ั‚ะตั€ะผะธะฝะฐะผะธ. ะะธะถะต ะพะฟะธัะฐะฝั‹ ะพัะฝะพะฒะฝั‹ะต ะธะท ะฝะธั…. ### usetype - ั‚ะธะฟ ะฟะพะปัŒะทะพะฒะฐะฝะธั ะธะฝั‚ะตั€ะฝะตั‚ะพะผ ะ’ะพะทะผะพะถะฝั‹ะต ะฒะฐั€ะธะฐะฝั‚ั‹: - 1 - ...
github_jupyter
# Text in Python Fรผr die computergestรผtzte Textanalyse sind Texte zunรคchst nur eine Aneinanderreihung von Buchstaben oder genauer: Zeichen. Diese Art von Text, die ohne Formatierung wie Schriftart, SchritgrรถรŸe oder Fettungen auskommt, wird als โ€œplain textโ€ bezeichnet. Plain text erhรคlt man etwa, wenn man ein Word-Doku...
github_jupyter
``` # Update sklearn to prevent version mismatches # !conda install scikit-learn # !conda update scikit-learn # !conda install joblib # !conda update joblib import pandas as pd import numpy as np import pprint import matplotlib.pyplot as plt import warnings warnings.filterwarnings("ignore") ``` # Read the CSV ``` df...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import h5py def load_data(): train_dataset = h5py.File(r'./dataset/train_catvnoncat.h5', "r") train_set_x_orig = np.array(train_dataset["train_set_x"][:]) train_set_y_orig = np.array(train_dataset["train_set_y"][:]) test_dataset = h5py.File(r'....
github_jupyter
# First Study on Brazilian Cities Transparency Portal In this dataset we have a population projection for each Brazilian city in the year of 2013. ``` import pandas as pd import numpy as np # We first collected the data with population estimatives, # we can use it later to do some comparisions or to use it later cit...
github_jupyter
# ๅˆ›ๅปบ่‡ชๅฎšไน‰่ฝฌๆขๅ™จ ``` import nltk nltk.download(['punkt', 'wordnet', 'averaged_perceptron_tagger']) import re import numpy as np import pandas as pd from nltk.tokenize import word_tokenize, sent_tokenize from nltk.stem import WordNetLemmatizer from nltk import pos_tag from sklearn.pipeline import Pipeline, FeatureUnion from...
github_jupyter
# Exercise Solutions --- ## Pythonic Exercises 1. Create a list of your favourite superheros and another list of their secret identities. 1. Convert your two lists into a dictionary. (Can you do it in one line?) 1. Remove one of your heroes and add a villain to your dictionary. 1. Add a character that ha...
github_jupyter
[![imagenes](imagenes/pythonista.png)](https://pythonista.mx) # Expresiones regulares. Las expresiones regulares son parte de los lenguajes formales y corresponden a una secuencia de caracteres que definen un patrรณn. Mediante el uso de expresiones regulares, es posible buscar patrones dentro de un flujo de texto. ...
github_jupyter
# Lasso Regression with StandardScaler This Code template is for the regression analysis using a Lasso Regression and the feature rescaling technique StandardScaler in a pipeline. ### Required Packages ``` import warnings import numpy as np import pandas as pd import seaborn as se import matplotlib.pyplot as plt ...
github_jupyter
# Decision Analysis 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/ imp...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
# ๐Ÿ“ Exercise M6.01 The aim of this notebook is to investigate if we can tune the hyperparameters of a bagging regressor and evaluate the gain obtained. We will load the California housing dataset and split it into a training and a testing set. ``` from sklearn.datasets import fetch_california_housing from sklearn.m...
github_jupyter
<a href="https://colab.research.google.com/github/microprediction/timemachines/blob/main/CompareToNaive.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` !pip install timemachines !pip install --upgrade statsmodels ``` # Example of comparing agai...
github_jupyter
``` import urllib import json import numpy as np import itertools import torch from os import listdir import os from os.path import isfile, join import time import requests import json import pickle import base64 from io import BytesIO from PIL import Image from tqdm import tqdm import cv2 from matplotlib import pyplo...
github_jupyter
``` import numpy import numpy as np import numpy.random as rn import matplotlib.pyplot as plt # to plot import matplotlib as mpl from scipy import optimize # to compare ''' DESCRIPTION Calculates Annual Energy Production (AEP) of a Wind Farm ============================================================ ...
github_jupyter
<a href="https://colab.research.google.com/github/Lindronics/honours_project/blob/master/notebooks/classification/Image_classification_1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Image classification test 1 The purpose of this test is to: *...
github_jupyter
``` import sys, os import numpy as np import pandas as pd from matplotlib import pyplot as plt from scipy.stats import bayes_mvs as bayesest import time sys.path.insert(0, '../../../PyEcoLib') from PopSimulator import PopSimulator from simulator import Simulator %matplotlib inline %matplotlib inline mean_size = 3 # ...
github_jupyter
**Hidden Markov models for cracking codes** In this exercise you have to make a partially built HMM work and use it to solve some simple substitution ciphers. Plaintext data is provided in 'plaintext' directory. Encrypted data is in 'encrypted'. Some of the texts were originally English some of them were Russian; the ...
github_jupyter
<a href="https://apssdc.in"><img src="https://camo.githubusercontent.com/e7501c5948d48f88dad8ab2ab6bd448e1cfd6c79/68747470733a2f2f64726976652e676f6f676c652e636f6d2f75633f6578706f72743d646f776e6c6f61642669643d3135414b51365f2d42697857344b366d4c36525070684635454b58715946327a6a" width="900" align="center"></a> <h1><center...
github_jupyter
![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png) # Training Entity Coding Models (SNOMED example) ``` import os import json import string import numpy as np import pandas as pd import sparknlp import sparknlp_jsl from sparknlp.base import * from sparknlp.util import * from sparknlp.annotator imp...
github_jupyter
# Happy Valentine's Day <img src = 'Valentine.jpg' width="400"> <font color=red>**Let us celebrate Valentine's Day by doing something cool, e.g.,**</font> # Lithofacies classification and prediction using support vector machines In this exercise, we will train a support vector machine classifier to predict facies us...
github_jupyter
# Time Series Forecasting in Python https://www.analyticsvidhya.com/blog/2016/02/time-series-forecasting-codes-python/ ## Loading and Handling Time Series in Pandas ``` %matplotlib inline import matplotlib.pyplot as plt import pandas as pd import numpy as np from statsmodels.tsa.stattools import adfuller from statsm...
github_jupyter
<a href="https://colab.research.google.com/github/cxbxmxcx/Evolutionary-Deep-Learning/blob/main/EDL_5_DE_HPO_PCA.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Setup ``` #@title Install DEAP !pip install deap --quiet #@title Defining Imports #nu...
github_jupyter
# Now You Code 4: Sentiment v1.0 Let's write a basic sentiment analyzer in Python. Sentiment analysis is the act of extracting mood from text. It has practical applications in analyzing reactions in social media, product opinions, movie reviews and much more. The 1.0 version of our sentiment analyzer will start with ...
github_jupyter
# Heteroskedastic Likelihood and Multi-Latent GP ## Standard (Homoskedastic) Regression In standard GP regression, the GP latent function is used to learn the location parameter of a likelihood distribution (usually a Gaussian) as a function of the input $x$, whereas the scale parameter is considered constant. This is...
github_jupyter
``` #hide #skip ! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab #export from fastai.data.all import * from fastai.optimizer import * from fastai.learner import * #hide from nbdev.showdoc import * #default_exp metrics # default_cls_lvl 3 ``` # Metrics > Definition of the metrics that can be use...
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
# TensorTrade - Renderers and Plotly Visualization Chart ## Data Loading Function ``` import pandas as pd def load_csv(filename): df = pd.read_csv('data/' + filename, skiprows=1, parse_dates=['date']) df.drop(columns=['symbol', 'volume_btc'], inplace=True) # Fix timestamp form "2019-10-17 09-AM" to "2019...
github_jupyter
General outline: I want to take in an array (later image) representation of a scrabble board/hand tiles, and output the best play. Naive best play: the highest scoring play Goal best play: the play that maximizes your winning chances (takes into account the opponent's potential score) * You want to maximize how y...
github_jupyter