code
stringlengths
2.5k
150k
kind
stringclasses
1 value
``` import json import os import random import re from itertools import product import numpy as np import pandas as pd from more_itertools import distinct_combinations from plotnine import * from sklearn import feature_extraction, metrics ROOT_PATH = os.path.dirname(os.path.abspath(os.getcwd())) def inspect_df(df: p...
github_jupyter
``` # default_exp checker ``` # Dependency Checker > A pragmatic way to talk with pypi and find out what dependencies are out of date ``` #hide from nbverbose.showdoc import * ``` ## Dependency Traversing Sometimes, we may want to check the current installed versions of a project's basic dependencies, and further ...
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
SPARQL Transformer evaluation ========================= This notebook contains some quantitative measures for the evaluation of SPARQL Transformer. ``` import json import os import time import numpy as np import pandas as pd import matplotlib.pyplot as plt from ipywidgets import FloatProgress from IPython.display i...
github_jupyter
# WeatherPy ---- #### Note * Instructions have been included for each segment. You do not have to follow them exactly, but they are included to help you think through the steps. ``` # Dependencies and Setup import matplotlib.pyplot as plt import pandas as pd import numpy as np import requests import time from scipy.s...
github_jupyter
``` #Import the necessary methods from tweepy library from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream #Variables that contains the user credentials to access Twitter API access_token = "your_access_token" access_token_secret = "your_access_secret_token" consumer_k...
github_jupyter
# Numerical Stability and Initialization :label:`sec_numerical_stability` Thus far, every model that we have implemented required that we initialize its parameters according to some pre-specified distribution. Until now, we took the initialization scheme for granted, glossing over the details of how these choices are...
github_jupyter
# hello paddle: 从普通程序走向机器学习程序 **作者:** [PaddlePaddle](https://github.com/PaddlePaddle) <br> **日期:** 2021.12 <br> **摘要:** 这篇示例向你介绍普通程序跟机器学习程序的区别,并带着你用飞桨框架,实现第一个机器学习程序。 ## 一、普通程序跟机器学习程序的逻辑区别 作为一名开发者,你最熟悉的开始学习一门编程语言,或者一个深度学习框架的方式,可能是通过一个hello world程序。 学习飞桨也可以这样,这篇小示例教程将会通过一个非常简单的示例来向你展示如何开始使用飞桨。 机器学习程序跟通常的程序最大的不同是,通常的...
github_jupyter
``` %run ..\notebooks\Util_func.ipynb # # Bay Area # REG = 'BayArea' # base_dir = r'Q:\Data\Surveys\HouseholdSurveys\MTC-SFCTA2018\Processing_20200228\2_tour_extract\wt_wkday' # allwk_dir = r'Q:\Data\Surveys\HouseholdSurveys\MTC-SFCTA2018\Processing_20200228\2_tour_extract\wt_7day' # raw_dir = r'Q:\Data\Surveys\Househo...
github_jupyter
# Accumulation of roundoof error In this notebook we'll study some effects of accumulation of roundoof error. # Unstable Algorithms We need to solve this integral for $n=1,2,....8$ $$y_n=\int_0^1\frac{x^n}{x+5}$$ We write the equation like this: $$y_n = \frac{1}{n} - 5y_{n-1}$$ $$y_{1}=1-5(y_{0}+\epsilon )=1-5y_{0...
github_jupyter
# What does data look like ## What libraries should I import? ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt ``` ## How to read data? Dummy data for the following exercises is provided [here](https://ruhr-uni-bochum.sciebo.de/s/Svwxncw01Ir9uxw). ``` file = '/Users/guillermo/Downloads/pos...
github_jupyter
``` import pandas as pd import re from nltk import word_tokenize from nltk.corpus import stopwords from nltk.stem.wordnet import WordNetLemmatizer from sklearn.feature_extraction.text import CountVectorizer import numpy as np import collections ``` **Load the data and split them** ``` oush_df = pd.read_csv('./reuters...
github_jupyter
# Inventory Control with Lead Times and Multiple Suppliers ## Description One potential application of reinforcement learning involves ordering supplies with mutliple suppliers having various lead times and costs in order to meet a changing demand. Lead time in inventory management is the lapse in time between when ...
github_jupyter
``` import numpy as np import pandas as pd import tensorflow as tf from data_process import build_vocab, batch_iter, sentence_to_index from models import LSTM, biLSTM, deepBiLSTM train = pd.read_csv('./data/train-5T.txt', delimiter='\t') test = pd.read_csv('./data/test-1T.txt', delimiter='\t') X_train = train.document ...
github_jupyter
<a href="https://colab.research.google.com/github/aksha1234/Deep-learning-tutorials/blob/main/code_04_XX_Iris_Deep_Learning_Classification_with_penguin_Example.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Deep Learning Example - Iris This exa...
github_jupyter
``` # Import needed packages import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score, confusion_matrix, classification_report # If yo...
github_jupyter
[Table of Contents](http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/table_of_contents.ipynb) # Nonlinear Filtering ``` #format the book %matplotlib inline from __future__ import division, print_function from book_format import load_style load_style() ``` ## Introduction T...
github_jupyter
# Fig. 6 This notebook load and combine the output files produced by the script `power.py` to produce the figure shown in the paper. Output from ```power.py``` are saved in pickle files with name `"theta_"+str(theta)+':_eta_'+str(eta)+specifier+".pkl"`. Multiple outputs at the same theta are saved with different uniq...
github_jupyter
# Artificial Intelligence Nanodegree ## Machine Translation Project In this notebook, sections that end with **'(IMPLEMENTATION)'** in the header indicate that the following blocks of code will require additional functionality which you must provide. Please be sure to read the instructions carefully! ## Introduction I...
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
# Classifying Business Documents using Deep Learning ## IBM Coursera Advanced Data Science Capstone - Results Demo ## Sumudu Tennakoon ``` import pandas as pd import numpy as np import sys import os import re import matplotlib.pyplot as plt from datetime import date from sklearn.model_selection import train_test_spl...
github_jupyter
# Louvain Community Detection In this notebook, we will use cuGraph to identify the cluster in a test graph using the Louvain algorithm Notebook Credits * Original Authors: Bradley Rees and James Wyles * Created: 08/01/2019 * Last Edit: 03/03/2020 RAPIDS Versions: 0.13 Test Hardware * GV100 32G, CUDA 10.2 #...
github_jupyter
``` # default_exp callback.noisy_student ``` # Noisy student > Callback to apply noisy student self-training (a semi-supervised learning approach) based on: Xie, Q., Luong, M. T., Hovy, E., & Le, Q. V. (2020). Self-training with noisy student improves imagenet classification. In Proceedings of the IEEE/CVF Conference...
github_jupyter
# Numpy The basis of most scientific programming in Pyhton is the *numerical Python* library, `numpy`. NumPy gives us many tools - including a fast and efficient data type, the `numpy Array` - for working with numerical data. ## Numpy Array NumPy is built around the `array`. This is a data structure defined in NumP...
github_jupyter
# Adquisión de datos `DIRECTO` - [X] descarga directa - petición GET a través de API de terceros (ej. AEMET, Ayto. Barcelona....) - web crawling (que es una práctica ilegal...pero muy de moda entre los hackers!?¿!) *** ## Primer paso Es trabajar con los datos en formato `JSON` ``` # Primero vamos a entender el funci...
github_jupyter
# Character-Level LSTM in PyTorch In this notebook, I'll construct a character-level LSTM with PyTorch. The network will train character by character on some text, then generate new text character by character. As an example, I will train on Anna Karenina. **This model will be able to generate new text based on the te...
github_jupyter
# Ray RLlib - Sample Application: CartPole © 2019-2021, Anyscale. All Rights Reserved ![Anyscale Academy](../images/AnyscaleAcademyLogo.png) We were briefly introduced to the `CartPole` example and the OpenAI gym `CartPole-v1` environment ([gym.openai.com/envs/CartPole-v1/](https://gym.openai.com/envs/CartPole-v1/))...
github_jupyter
``` #解压一下略小改之后的PaddleSeg,解压一次就可以注释掉了 !unzip -oq /home/aistudio/PaddleSeg.zip #解压数据集至data/目录 !unzip -qo data/data95249/train_50k_mask.zip -d data/ !unzip -oq data/data100087/B榜测试数据集.zip -d data/ !unzip -oq data/data95249/train_image.zip -d data/ import sys sys.path.append("PaddleSeg") import paddleseg import padd...
github_jupyter
``` import tensorflow as tf tf.config.experimental.list_physical_devices() tf.test.is_built_with_cuda() ``` # Importing Libraries ``` import numpy as np import pandas as pd from matplotlib import pyplot as plt import os.path as op import pickle import tensorflow as tf from tensorflow import keras from keras.models im...
github_jupyter
# Paper Trends ## Imports ``` %load_ext autoreload %autoreload 2 %aimport %matplotlib inline import os import sys nb_dir = os.path.dirname(os.path.split(os.getcwd())[0]) if nb_dir not in sys.path: sys.path.append(nb_dir) from tqdm import tqdm_notebook as tqdm import pandas as pd from turicreate import SFrame, loa...
github_jupyter
### This is an example of where Scipy default optimizer (L-BFGS-B) does not correctly estimate the inefficiency variance. Even with $\gamma$ set to 0 and small measurement error, it estimates $\eta = 0$. #### January 22, 2021 (after SFMA meeting) Install the latest commit of `anml` from GitHub and the `logerf` branch ...
github_jupyter
# Residual Networks Welcome to the second assignment of this week! You will learn how to build very deep convolutional networks, using Residual Networks (ResNets). In theory, very deep networks can represent very complex functions; but in practice, they are hard to train. Residual Networks, introduced by [He et al.](h...
github_jupyter
``` !pip install rdflib !pip install folium !pip install pyproj storage = "https://raw.githubusercontent.com/opencitydata/guia-rdf-datosgob/main/rdf-explotacion/terrazas-madrid.nt" #poner el enlace a tus datos en github (raw files) from rdflib import Graph, Namespace, Literal from rdflib.plugins.sparql import prepareQ...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#1.-Addition-and-subtraction" data-toc-modified-id="1.-Addition-and-subtraction-1">1. Addition and subtraction</a></span></li><li><span><a href="#2.-Multiplication-and-division-(element-by-element)" data-toc...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from matplotlib import rcParams rcParams['figure.figsize'] = 11.7,8.27 # figure size in inches pd.options.mode.chained_assignment = None # default='warn' pd.set_option('display.max_colwidth', None) pd.set_option('display....
github_jupyter
# Training Job in Internet-free Mode If you want to isolate your training data and training container from the rest of the Internet, then you should create the training job in a private subnet. A private subnet is a subnet in your VPC without a route to an Internet Gateway. This means, by default, no inbound calls to ...
github_jupyter
``` import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib.dates as mdates from datetime import date from datetime import datetime import numpy as np from summer.utils import ref_times_to_dti from autumn.tools.inputs.demography.queries import get_population_by_agegroup from autumn.models.covid_1...
github_jupyter
##### (exceprt from Python Machine Learning Essentials, Supplementary Materials) ## Sections - [Classifying handwritten digits](#Classifying-handwritten-digits) - [Obtaining the MNIST dataset](#Obtaining-the-MNIST-dataset) - [Implementing a multi-layer perceptron](#Implementing-a-multi-layer-perceptron) - [Tr...
github_jupyter
``` # default_exp starter ``` # Starter Code > Utility functions for binary classification on scientific paper abstracts using GPT-2 ``` #hide from nbdev.showdoc import * ``` ## GPT-2 Prompt Manipulation The simplest approach is to to feed in a small number of trainging examples into the prompt directly for zero-s...
github_jupyter
# Master Pytorch 7 : RNN Basic - RNN의 기초에 대해 알아보자 # RNN one Cell process ``` import torch import torch.nn as nn # hello에 있는 각각의 문자들을 원핫벡터로 변환 h = [1, 0, 0, 0] e = [0, 1, 0, 0] l = [0, 0, 1, 0] o = [0, 0, 0, 1] # RNN의 한 cell 정의 후 출력 cell = nn.RNN(input_size = 4, hidden_size = 2, batch_first = True) cell hidden = to...
github_jupyter
# Self-Driving Car Engineer Nanodegree ## Project: **Finding Lane Lines on the Road** *** In this project, you will use the tools you learned about in the lesson to identify lane lines on the road. You can develop your pipeline on a series of individual images, and later apply the result to a video stream (really j...
github_jupyter
# Algorithm used : ![Sarsa](SarsaAlgo.png) ``` %matplotlib inline import gym import itertools import matplotlib import numpy as np import pandas as pd import sys if "../" not in sys.path: sys.path.append("../") from collections import defaultdict from lib.envs.windy_gridworld import WindyGridworldEnv from lib ...
github_jupyter
# References and ports GDS allows defining the component once in memory and reference to that structure in other components. As you build complex components you can include references to other simpler components. Adding a reference is like having a pointer to a component. The GDSII specification allows the use of re...
github_jupyter
# Processing training data from raw files # Notebook n°1 ``` basepath = '/data/conda/recnn/data' ### Importing usefull packages ### %load_ext cython import sys import copy import numpy as np import multiprocessing as mp from functools import partial from rootpy.vector import LorentzVector sys.path.append("..") ### I...
github_jupyter
# Plagiarism Text Data In this project, you will be tasked with building a plagiarism detector that examines a text file and performs binary classification; labeling that file as either plagiarized or not, depending on how similar the text file is when compared to a provided source text. The first step in working wi...
github_jupyter
# 图像分类 在此项目中,你将对 [CIFAR-10 数据集](https://www.cs.toronto.edu/~kriz/cifar.html) 中的图片进行分类。该数据集包含飞机、猫狗和其他物体。你需要预处理这些图片,然后用所有样本训练一个卷积神经网络。图片需要标准化(normalized),标签需要采用 one-hot 编码。你需要应用所学的知识构建卷积的、最大池化(max pooling)、丢弃(dropout)和完全连接(fully connected)的层。最后,你需要在样本图片上看到神经网络的预测结果。 ## 获取数据 请运行以下单元,以下载 [CIFAR-10 数据集(Python版)](https:/...
github_jupyter
``` # Deprecated # packages: random import random # packages: data structure import numpy as np import pandas as pd import astropy.io as io # packages: image generation and plot generation from matplotlib import pyplot as plt # pandas # https://pandas.pydata.org/pandas-docs/stable/tutorials.html # https://pandas.pyda...
github_jupyter
# <img style="float: left; padding-right: 10px; width: 45px" src="https://raw.githubusercontent.com/Harvard-IACS/2018-CS109A/master/content/styles/iacs.png"> CS-109B Introduction to Data Science ## Lab 6: Convolutional Neural Networks 2 **Harvard University**<br> **Spring 2020**<br> **Instructors:** Mark Glickman, Pav...
github_jupyter
# Logical Operators This notebook demonstrates use of the `ge` infix function for the comparison of two tensors. In this particular example, the probablity density `f` at two-dimensional location `(x, y)` is compared against a value `u` drawn uniformly from the unit interval `[0, 1)`. If `f(x, y) >= u`, or `f(x, y) ge...
github_jupyter
# Global And Local Alignment ``` import sys import numpy as np from collections import Counter import re from collections import defaultdict from functools import partial ``` The score_function returns a score for a pair of characters. These may be the same different or one may be missing. The code supports three s...
github_jupyter
<a href="https://colab.research.google.com/github/Bertha-ding/20MA573-yuning-ding/blob/master/hw/hw3-3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> - Prove the following facts: Supose $f$ is a function satisfying - $f(0) = f_{min},$ and $\lim_{...
github_jupyter
# Chapter 2: Conditional probability ---- ``` import numpy as np ``` ## Simulating the frequentist interpretation Recall that the frequentist interpretation of conditional probability based on a large number `n` of repetitions of an experiment is $P(A|B) ≈ n_{AB}/n_{B}$, where $n_{AB}$ is the number of times that...
github_jupyter
# Building your Deep Neural Network: Step by Step Welcome to your week 4 assignment (part 1 of 2)! You have previously trained a 2-layer Neural Network (with a single hidden layer). This week, you will build a deep neural network, with as many layers as you want! - In this notebook, you will implement all the functio...
github_jupyter
# Part 1: Packaging and Uploading your Algorithm for use with Amazon SageMaker ### An overview of Docker If you're familiar with Docker already, you can skip ahead to the next section. For many data scientists, Docker containers are a new technology. But they are not difficult and can significantly simplify the depl...
github_jupyter
``` # !pip3 install bert-tensorflow --user # !wget https://storage.googleapis.com/bert_models/2018_11_23/multi_cased_L-12_H-768_A-12.zip # !unzip multi_cased_L-12_H-768_A-12.zip import bert from bert import run_classifier from bert import optimization from bert import tokenization from bert import modeling import numpy...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np ``` # Text Classification of Movie Reviews ``` from helpers import Timer from sklearn.datasets import load_files reviews_train = load_files("aclImdb/train/") text_train, y_train = reviews_train.data, reviews_train.target print("Number of docum...
github_jupyter
<p style="font-family: Arial; font-size:3.75vw;color:purple; font-style:bold"><br> matplotlib Exercise Notebook </p><br> # Exercise Notebook Instructions ### 1. Important: Only modify the cells which instruct you to modify them - leave "do not modify" cells alone. The code which tests your responses assumes you ha...
github_jupyter
``` %matplotlib inline import numpy as np import pandas as pd import matplotlib import seaborn as sns import matplotlib.pyplot as plt from sklearn.decomposition import PCA from sklearn.feature_selection import SelectFromModel from sklearn.linear_model import Ridge, Lasso, ElasticNet from sklearn.discriminant_analysis ...
github_jupyter
# Variational Inference and Learning in the Big Data Regime Many real-world modelling solutions require fitting models with large numbers of data-points and parameters, which is made convenient recently through software implementing automatic differentiation, but also require uncertainty quantification. Variational in...
github_jupyter
# 用飛槳+ DJL 實作人臉口罩辨識 在這個教學中我們將會展示利用 PaddleHub 下載預訓練好的 PaddlePaddle 模型並針對範例照片做人臉口罩辨識。這個範例總共會分成兩個步驟: - 用臉部檢測模型識別圖片中的人臉(無論是否有戴口罩) - 確認圖片中的臉是否有戴口罩 這兩個步驟會包含使用兩個 Paddle 模型,我們會在接下來的內容介紹兩個模型對應需要做的前後處理邏輯 ## 導入相關環境依賴及子類別 在這個例子中的前處理飛槳深度學習引擎需要搭配 DJL 混合模式進行深度學習推理,原因是引擎本身沒有包含 NDArray 操作,因此需要藉用其他引擎的 NDArray 操作能力來完成。這邊我們導入 PyTorch ...
github_jupyter
# "Understanding Residual Networks" > "Probably about residuals, right?" - comments: true - categories: [vision] ``` #hide !pip install -Uqq fastai>=2.0.0 graphviz ipywidgets matplotlib nbdev>=0.2.12 pandas scikit_learn azure-cognitiveservices-search-imagesearch sentencepiece #hide from google.colab import drive driv...
github_jupyter
<a href="https://colab.research.google.com/github/VishnuM24/LetsUpgrade-Python/blob/master/Assignment_Day_2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # - DAY 2 - ##**QUESTION 1 :** List & its default methods ``` vowels = [ 'a', 'e' ] # Meth...
github_jupyter
``` import pandas as pd import numpy as np credit_df=pd.read_csv(r'E:\Projects\Movie recommendation System\DataSet\tmdb_5000_credits.csv') movie_df=pd.read_csv(r'E:\Projects\Movie recommendation System\DataSet\tmdb_5000_movies.csv') #movie_df.head() #credit_df.head() credit_df.columns=['id','title','cast','crew'] ...
github_jupyter
# ML Strategy * Collect more data * Collect more diverse trainign set * Train algorithm longer with gradient descetn * Try adam isntead of gradient descent * Try bigger networks * Try smaller networks * Try dropout * Add L2 regularizatión * Network architecture * Network archicteture - Activvation - \# hidden...
github_jupyter
# Travail Ecrit - Python * Gymnase du Bugnon, site de l'Ours * OC informatique * Sujet : chapitres 1-10 du livre *Pensez en Python* * Mirko Pirona * Date : jeudi 13 novembre 2018 ## **Exercice : expression arithmétique** Initialisez les variables `(a, b, c, x)` avec les valeurs `(2, 3, 4, 5)`. Calculez l'expressio...
github_jupyter
# Pyomo Examples ## Example 19.3: Linear Programming Refinery ``` import pandas as pd PRODUCTS = ['Gasoline', 'Kerosine', 'Fuel Oil', 'Residual'] FEEDS = ['Crude 1', 'Crude 2'] products = pd.DataFrame(index=PRODUCTS) products['Price'] = [72, 48, 42, 20] products['Max Production'] = [24000, 2000, 6000, 100000] crud...
github_jupyter
``` %run homework_modules.ipynb import torch from torch.autograd import Variable import numpy import unittest class TestLayers(unittest.TestCase): def test_Linear(self): np.random.seed(42) torch.manual_seed(42) batch_size, n_in, n_out = 2, 3, 4 for _ in range(100): # lay...
github_jupyter
``` # Visualization of the KO+ChIP Gold Standard from: # Miraldi et al. (2018) "Leveraging chromatin accessibility for transcriptional regulatory network inference in Th17 Cells" # TO START: In the menu above, choose "Cell" --> "Run All", and network + heatmap will load # NOTE: Default limits networks to TF-TF edges i...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt plt.style.use('default') ``` ### Data Awal Data berasal dari dataset DARPA 2000. DDoS attack terjadi pada 2 jam 6 menit 15 detik setelah trafik mulai direkam ``` df = pd.read_csv("../data/darpa2000-all.csv") del df["Info"] del df["Length"] df....
github_jupyter
# <center> #DHBSI 2016: Computational Text Analysis </center> ## <center> Laura Nelson <br/> <em>Postdoctoral Fellow | Digital Humanities @ Berkeley | Berkeley Institute for Data Science </em> </center> ## <center> Teddy Roland <br/> <em> Coordinator, Digital Humanities @ Berkeley <br/> Lecturer, UC Berkeley </em> ...
github_jupyter
# Data Preprocessing for Topic Monitoring(Facebook) ``` import pandas as pd import numpy as np import re import csv from langdetect import detect import nltk # nltk.download('punkt') # nltk.download('maxent_treebank_pos_tagger') # nltk.download('wordnet') # nltk.download('averaged_perceptron_tagger') # nltk.download('...
github_jupyter
``` %load_ext autoreload %autoreload 2 import sys import warnings warnings.filterwarnings("ignore") sys.path.append("../") from modules.data.conll2003.prc import conll2003_preprocess data_dir = "/home/eartemov/ae/work/conll2003/" conll2003_preprocess(data_dir) ``` ## IO markup ### Train ``` from modules.data imp...
github_jupyter
# Codigo Para Twitter por streaming ``` #Import the necessary methods from tweepy library from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream import json import time access_token = "227835837-WD07ixlyOeLqkeywbnMYzk5dnebJjd1pA4sKpOjl" access_token_secret = "6utbaX2ab3Ur...
github_jupyter
## Emerging Technologies #### Student name : Jina Kim G00353420 *** #### Jupyter notebook that trains a model using the data set. (powerproduction.csv) *** #### References Keras Fundamentals for Deep Learning. [1] Training & evaluation from tf.data Datasets. [2] *** [1] Keras Fundamentals for Deep Learning; gu...
github_jupyter
``` import torch from torchvision import transforms import torch.nn.functional as F import torch.nn as nn from PIL import Image import imageio import os from google.colab import drive from google.colab import drive drive.mount('/content/drive') class YOLO(nn.Module): def __init__(self, img_width, row_size): ...
github_jupyter
# Db2 11.5.4 RESTful Programming The following notebook is a brief example of how to use the Db2 11.5.4 RESTful Endpoint service to extend the capabilies of Db2. Programmers can create Representational State Transfer (REST) endpoints that can be used to interact with Db2. Each endpoint is associated with a single SQL...
github_jupyter
# Inference acceleration of `T5` for large batch size / long sequence length / > large models Every week or so, a new impressive few shots learning work taking advantage of autoregressive models is released by some team around the world. Still `LLM` inference is rarely discussed and few projects are focusing on this...
github_jupyter
``` !wget -q https://github.com/CISC-372/Notebook/releases/download/a4/test.csv !wget -q https://github.com/CISC-372/Notebook/releases/download/a4/train.csv # comment your understanding of each function import pandas as pd import csv xy_train_df = pd.read_csv('train.csv') x_test_df = pd.read_csv('test.csv', index_c...
github_jupyter
<a href="https://colab.research.google.com/github/anshradh/trl_custom/blob/test/04_writing_prompt_supervised_baseline_training.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #Writing Prompt Response Supervised Learning Baseline We fine-tune a langu...
github_jupyter
# Sentiment Classification & How To "Frame Problems" for a Neural Network by Andrew Trask - **Twitter**: @iamtrask - **Blog**: http://iamtrask.github.io ### What You Should Already Know - neural networks, forward and back-propagation - stochastic gradient descent - mean squared error - and train/test splits ### Wh...
github_jupyter
#### Importing the libraries ``` import pandas as pd import numpy as np ``` #### Reading the csv as dataframe ``` df = pd.read_csv('googleplaystore_user_reviews.csv') df.head(5) ``` *We will perform sentiment analysis on Google Play store user reviews* #### Renaming the column ``` df = df.rename(columns={'Transla...
github_jupyter
## Exploratory analysis of the US Airport Dataset This dataset contains data for 25 years[1995-2015] of flights between various US airports and metadata about these routes. Taken from Bureau of Transportation Statistics, United States Department of Transportation. Let's see what can we make out of this! ``` %matplot...
github_jupyter
Before we begin, we will change a few settings to make the notebook look a bit prettier ``` %%html <style> body {font-family: "Calibri", cursive, sans-serif;} </style> ``` <img src="https://github.com/IKNL/guidelines/blob/master/resources/logos/iknl_nl.png?raw=true" width=200 align="right"> # 01 - Pre-processing Pe...
github_jupyter
## Before we begin We need to install the mysql client software. My apologies that I forgot to install it in the virtual machine this year! open a Terminal window and type: sudo apt-get update sudo apt-get install mysql-client This will install the client software we need to connect to our...
github_jupyter
500 hPa Vorticity Advection =========================== Plot an 500-hPa map with calculating vorticity advection using MetPy calculations. Beyond just plotting 500-hPa level data, this uses calculations from `metpy.calc` to find the vorticity and vorticity advection. Currently, this needs an extra helper function to ...
github_jupyter
``` """ Snowflake Batch Prediction API Snowflake S3 scoring job v1.0 Mike Taveirne (doyouevendata) 3/21/2020 """ import pandas as pd import requests import time from pandas.io.json import json_normalize import snowflake.connector import my_creds #from imp import reload #reload(my_creds) # datarobot parameters API_KEY...
github_jupyter
``` import pandas as pd import numpy as np from sklearn.preprocessing import MinMaxScaler from sklearn.preprocessing import StandardScaler from sklearn import ensemble from sklearn.utils import shuffle from sklearn.metrics import mean_squared_error from sklearn.metrics import r2_score from sklearn.metrics import accura...
github_jupyter
## ENGR 213 Lecture Notes ### Lecture 10 #### Shear Stress: Now that we have some sense of shear and moment diagrams and how they relate to the normal stresses across the face of a cross section of a beam it's time to add another layer to our thinking. An important characteristic of the normal stress across the cross...
github_jupyter
# Inference and Validation Now that you have a trained network, you can use it for making predictions. This is typically called **inference**, a term borrowed from statistics. However, neural networks have a tendency to perform *too well* on the training data and aren't able to generalize to data that hasn't been seen...
github_jupyter
``` from __future__ import print_function ``` # Jupyter We'll be using Jupyter for all of our examples -- 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 ...
github_jupyter
``` from sklearn import model_selection, preprocessing, linear_model, naive_bayes, metrics, svm from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn import decomposition, ensemble #import textblob from keras.preprocessing import text, sequence from keras import layers, models, opti...
github_jupyter
**Import library** ``` import pandas as pd import numpy as np import calendar from datetime import datetime import time # Standard plotly imports import plotly.express as px import plotly.graph_objects as go import matplotlib.pyplot as plt import seaborn as sns sns.set_context("paper", font_scale=1.3) sns.set_style('w...
github_jupyter
``` from eppy import modeleditor from eppy.modeleditor import IDF import pandas as pd pip install pandas IDF.setiddname('/usr/local/bin/Energy+.idd') idf = IDF('/idf/det_pre/detatched_pre.idf') idf.epw = "idf/det_pre/IRL_Dublin.039690_IWEC.epw" idf.run(expandobjects=True, readvars=True, output_directory="/idf/det_pre")...
github_jupyter
<a href="https://colab.research.google.com/github/ewotawa/secure_private_ai/blob/master/Section_2_Federated_Learning_Final_Project.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Federated Learning Final Project ## Overview * See <a href="https:...
github_jupyter
## Import the necessary libraries ``` import numpy as np import missingno as miss import os import glob from pathlib import Path from datetime import datetime import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import matplotlib.cm as cm import sklearn from xgboost import XGBClassifier %matplotli...
github_jupyter
``` % load_ext autoreload % autoreload 2 % matplotlib inline import matplotlib.pyplot as plt import numpy as np import torch device = 'cuda' if torch.cuda.is_available() else 'cpu' import os, sys opj = os.path.join from tqdm import tqdm from ex_mnist import p from dset import get_dataloader sys.path.append('../../s...
github_jupyter
# File I/O So far we discussed how to process data, how to build, train and test deep learning models. However, at some point we are likely happy with what we obtained and we want to save the results for later use and distribution. Likewise, when running a long training process it is best practice to save intermediate...
github_jupyter
# Twitter Konversationen zu einem Thema als Netzwerk untersuchen - Aus Twitter-Daten kann man besonders gut Netzwerke basteln. - Dabei können wir frei definieren,wann eigentlich ein Nutzer mit einem anderen verbunden ist. Die gebräuchlichsten Definitionen sind: 1. Nutzer A retweetet Nutzer B (RT plotti was für ein...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt # for plotting import numpy as np # for matrix and vector computations import pandas as pd import seaborn as sns ``` ### Debugging * Python array indices start from zero * Vector/matrix operations work only with numpy arrays.Inspect matrix operations to make sur...
github_jupyter
# 과제 데이터셋을 좀 더 쉽게 다룰 수 있도록 유용한 도구로서 torch.utils.data.Dataset과 torch.utils.data.DataLoader를 제공 한다. 이를 사용하면 미니 배치 학습, 데이터 셔플(shuffle), 병렬 처리까지 간단히 수행할 수 있다. 기본적인 사용 방법은 Dataset을 정의하고, 이를 DataLoader에 전달하는 것이다 # 커스텀 데이터셋(Custom Dataset) torch.utils.data.Dataset을 상속받아 직접 커스텀 데이터셋(Custom Dataset)을 만들 수 있다. Dataset을...
github_jupyter