code
stringlengths
2.5k
150k
kind
stringclasses
1 value
**Introduction to Python**<br/> Prof. Dr. Jan Kirenz <br/> Hochschule der Medien Stuttgart <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Import-data" data-toc-modified-id="Import-data-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Import data</a></...
github_jupyter
## Series ``` import pandas as pd import numpy as np import random first_series = pd.Series([1,2,3, np.nan ,"hello"]) first_series series = pd.Series([1,2,3, np.nan ,"hello"], index = ['A','B','C','Unknown','String']) series #indexing the Series with custom values dict = {"Python": "Fun", "C++": "Outdated","Coding":"H...
github_jupyter
## Convolutional Neural Network Using SVM as Final Layer ``` from tensorflow.compat.v1 import ConfigProto from tensorflow.compat.v1 import InteractiveSession config = ConfigProto() config.gpu_options.per_process_gpu_memory_fraction = 0.4 config.gpu_options.allow_growth = True session = InteractiveSession(config=confi...
github_jupyter
# [Module 2.2] 세이지 메이커 인퍼런스 본 워크샵의 모든 노트북은 `conda_python3` 추가 패키지를 설치하고 모두 이 커널 에서 작업 합니다. - 1. 배포 준비 - 2. 로컬 앤드포인트 생성 - 3. 로컬 추론 --- 이전 노트북에서 인퍼런스 테스트를 완료한 티펙트를 가져옵니다. ``` %store -r artifact_path ``` # 1. 배포 준비 ``` print("artifact_path: ", artifact_path) import sagemaker sagemaker_session = sagemaker.Session...
github_jupyter
# IPython.display youtube url for learning https://www.youtube.com/watch?v=YPgImo9kcbg&list=PLoTScYm9O0GFVfRk_MmZt0vQXNIi36LUz&index=12 ``` from IPython.display import IFrame, YouTubeVideo, SVG, HTML ``` ## Display Web page ``` IFrame("https://matplotlib.org/examples/color/named_colors.html", width=800, height=300)...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from plotnine import * ``` Leitura e visualização dos dados: ``` #carregar os dados no dataframe df = pd.read_csv('movie_metadata.csv') df.head() df.shape df.dtypes list(df.columns) ``` Análise Exploratória ``` df['color'].value_counts() ...
github_jupyter
# MNIST digit recognition Neural Network --- # 1. Imports --- ``` import pandas as pd import matplotlib.pyplot as plt from keras.datasets import mnist from keras.models import Sequential from keras.utils import np_utils from keras.layers import Dense ``` # 2. Understanding the data --- ## 2.1. Load the dataset and ...
github_jupyter
# 使用PyNative进行神经网络的训练调试体验 [![查看源文件](https://gitee.com/mindspore/docs/raw/master/resource/_static/logo_source.png)](https://gitee.com/mindspore/docs/blob/master/docs/notebook/mindspore_debugging_in_pynative_mode.ipynb) ## 概述 在神经网络训练过程中,数据是否按照自己设计的神经网络运行,是使用者非常关心的事情,如何去查看数据是怎样经过神经网络,并产生变化的呢?这时候需要AI框架提供一个功能,方便使用者将计算图中的...
github_jupyter
``` import urllib.request import json import glob import pandas as pd import numpy as np import datetime ``` Get data from sensors ``` # this cell gets data URL = "http://165.227.244.213:8881/luftdatenGet/22FQ8dJEApww33p31935/9d93d9d8cv7js9sj4765s120sllkudp389cm/" response = urllib.request.urlopen(URL) data = json.l...
github_jupyter
<a href="https://colab.research.google.com/github/RachitBansal/AppliancePower_TimeSeries/blob/master/ARIMA_Ukdale.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/drive',force_remount=True) fro...
github_jupyter
``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split, cross_val_score, GridSearchCV from sklearn.preprocessing import StandardScaler, LabelEncoder, OrdinalEncoder from sklearn.pipeline import make_pipeline from category_en...
github_jupyter
<a href="https://colab.research.google.com/github/AlsoSprachZarathushtra/Quick-Draw-Recognition/blob/master/(3_1)Stroke_LSTM_Skatch_A_Net_ipynb_.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Connect Google Drive ``` from google.colab import dri...
github_jupyter
# Creating a Sentiment Analysis Web App ## Using PyTorch and SageMaker _Deep Learning Nanodegree Program | Deployment_ --- Now that we have a basic understanding of how SageMaker works we will try to use it to construct a complete project from end to end. Our goal will be to have a simple web page which a user can u...
github_jupyter
# Desafio 5 Neste desafio, vamos praticar sobre redução de dimensionalidade com PCA e seleção de variáveis com RFE. Utilizaremos o _data set_ [Fifa 2019](https://www.kaggle.com/karangadiya/fifa19), contendo originalmente 89 variáveis de mais de 18 mil jogadores do _game_ FIFA 2019. > Obs.: Por favor, não modifique o ...
github_jupyter
``` import sys import numpy as np # linear algebra from scipy.stats import randint import matplotlib.pyplot as plt # this is used for the plot the graph %matplotlib inline from tqdm import notebook import tensorflow as tf from scipy import stats from scipy.interpolate import interp1d ``` ### Simulate data ``` np.ra...
github_jupyter
``` # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed und...
github_jupyter
``` ! rm visualising_the_results/* ``` # Visualising the results In this tutorial, we demonstrate the plotting tools built-in to `bilby` and how to extend them. First, we run a simple injection study and return the `result` object. ``` import bilby import matplotlib.pyplot as plt %matplotlib inline time_duration = ...
github_jupyter
# Arbitrarily high order accurate explicit time integration methods 1. Chapter 5: ADER and DeC 1. [Section 1.1: DeC](#DeC) 1. [Section 1.2: ADER](#ADER) ## Deferred Correction (Defect correction/ Spectral deferred correction)<a id='DeC'></a> Acronyms: DeC, DEC, DC, SDC References: [Dutt et al. 2000](https:/...
github_jupyter
# Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code, but left the implementation of the neural network up to you (for the most part). After you've submitted this project, feel free to explore the data and...
github_jupyter
# Data Retriving and Pre-processing **Importing Libraries** ``` # ALL THE IMPORTS NECESSARY %matplotlib inline %config InlineBackend.figure_format = 'retina' import matplotlib.pyplot as plt import pandas as pd import numpy as np from geopy.distance import great_circle as vc import math as Math ``` **Retriving Dat...
github_jupyter
``` import numpy as np import sklearn import os import pandas as pd import scipy from sklearn.linear_model import LinearRegression import sklearn import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.nn.functional as F import random from torchvision import datasets, transforms import copy #!pi...
github_jupyter
# Accumulation Distribution Line (ADL) https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:accumulation_distribution_line ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import warnings warnings.filterwarnings("ignore") # yfinance is used to fetch data import yfi...
github_jupyter
# Plagiarism Detection, Feature Engineering In this project, you will be tasked with building a plagiarism detector that examines an answer text file and performs binary classification; labeling that file as either plagiarized or not, depending on how similar that text file is to a provided, source text. Your first ...
github_jupyter
``` %load_ext autoreload %autoreload 2 %matplotlib inline %config InlineBackend.figure_format = 'retina' import warnings warnings.filterwarnings('ignore') ``` ## Introduction ``` from IPython.display import YouTubeVideo YouTubeVideo(id="BYOK12I9vgI", width="100%") ``` In this chapter, we will look at bipartite grap...
github_jupyter
``` # Internal python libraries import numpy as np import matplotlib.pyplot as plt # Esto controla el tamaño de las figuras en el script plt.rcParams['figure.figsize'] = (10, 10) import ipywidgets as ipw from ipywidgets import widgets, interact_manual from IPython.display import Image # Esto es para poder correr to...
github_jupyter
# Predict Model The aim of this notebook is to assess how well our [logistic regression classifier](../models/LR.csv) generalizes to unseen data. We will accomplish this by using the Matthew's Correlation Coefficient (MCC) to evaluate it's predictive performance on the test set. Following this, we will determine which...
github_jupyter
``` from kbc_pul.project_info import project_dir as kbc_e_metrics_project_dir import os from typing import List, Dict, Set, Optional import numpy as np import pandas as pd from artificial_bias_experiments.evaluation.confidence_comparison.df_utils import ColumnNamesInfo from artificial_bias_experiments.known_prop_sc...
github_jupyter
``` !pip install google_images_download #Imports import tensorflow as tf import keras from google.colab import drive import os from fastai.vision import * from fastai.metrics import error_rate import re from google_images_download import google_images_download # Start off with Mounting Drive Locally drive.mount('/conte...
github_jupyter
``` from IPython.display import HTML HTML('''<script> code_show=true; function code_toggle() { if (code_show){ $('div.input').hide(); } else { $('div.input').show(); } code_show = !code_show } $( document ).ready(code_toggle); </script> The raw code for this IPython notebook is by default hidden for easier rea...
github_jupyter
``` # %gui qt import numpy as np import mne import pickle import sys import os # import matplotlib from multiprocessing import Pool from tqdm import tqdm import matplotlib.pyplot as plt # import vispy # print(vispy.sys_info()) # BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # sys.path.append(B...
github_jupyter
# Cross Industry Standart Process for Data Mining In this section we are going to analise Boston AIRBNB Data Set. We are looking to help people on cleaning datasets e how to deal with some especific data. In this post we are going to cover all the subjects bellow: 1. Business Understanding: Understand the problem 2...
github_jupyter
# Hyperparameter Optimization [xgboost](https://github.com/dmlc/xgboost) What the options there're for tuning? * [GridSearch](http://scikit-learn.org/stable/modules/grid_search.html) * [RandomizedSearch](http://scikit-learn.org/stable/modules/generated/sklearn.grid_search.RandomizedSearchCV.html) All right! Xgboost h...
github_jupyter
##### Copyright 2020 The TensorFlow Hub 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...
github_jupyter
# Open, Re-usable Deep Learning Components on the Web ## Learning objectives - Use [ImJoy](https://imjoy.io/#/) web-based imaging components - Create a JavaScript-based ImJoy plugin - Create a Python-based ImJoy plugin *See also:* the [I2K 2020 Tutorial: ImJoying Interactive Bioimage Analysis with Deep Learning, Im...
github_jupyter
# MULTI-LABEL TEXT CLASSIFICATION FOR STACK OVERFLOW TAG PREDICTION ``` import pandas as pd import numpy as np from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.preprocessing import MultiLabelBinarizer from sklearn.model_selection import train_test_split from sklearn.linear_model import SGDClas...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt df = pd.read_excel('results fdu.xlsx') df2 = pd.read_excel('data trait category II 10 Mar 2021 all data - plain text.xlsx') df2.columns mean_N = df2.groupby(['Y_category2'])['Code'].count() mean_N mean_ = df2.groupby(['Y_category2','design.1']...
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 (htt...
github_jupyter
## Modules ``` from sklearn import metrics import scikitplot as skplt import seaborn as sns from sklearn.preprocessing import StandardScaler from sklearn import preprocessing import os import pandas as pd import matplotlib.pyplot as plt import numpy as np from sklearn import linear_model, decomposition, datasets from...
github_jupyter
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-59152712-8"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-59152712-8'); </script> # BSSN Time-Evolution Equations for the Gauge Fields $\alph...
github_jupyter
<a href="https://colab.research.google.com/github/Aditya-Singla/Banknote-Authentication/blob/master/Banknote_authentication.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> **Importing the libraries** ``` import pandas as pd import numpy as np ``` ...
github_jupyter
# A Char-RNN Implementation in Tensorflow *This notebook is slightly modified from https://colab.research.google.com/drive/13Vr3PrDg7cc4OZ3W2-grLSVSf0RJYWzb, with the following changes:* * Main parameters defined at the start instead of middle * Run all works, because of the added upload_custom_data parameter * Traini...
github_jupyter
# Simulations In this notebook we will show four methods for incorporating new simulations into Coba in order of easy to hard: 1. From an Openml.org dataset with **OpenmlSimulation** 2. From local data sets with **CsvSimulation**, **ArffSimulation**, **LibsvmSimulation**, and **ManikSimulation**. 3. From Python functio...
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
(tune-mnist-keras)= # Using Keras & TensorFlow with Tune ```{image} /images/tf_keras_logo.jpeg :align: center :alt: Keras & TensorFlow Logo :height: 120px :target: https://keras.io ``` ```{contents} :backlinks: none :local: true ``` ## Example ``` import argparse import os from filelock import FileLock from tenso...
github_jupyter
# Proper randomization is important... I changed the code of the MPI calibration code to do a global randomization (and not a randomization within each operation). ``` import os import numpy import pandas from extract_archive import extract_zip, aggregate_dataframe archive_names = {'nancy_2018-07-24_1621460.zip' : 'n...
github_jupyter
#### Implementation of Distributional paper for 1-dimensional games, such as Cartpole. - https://arxiv.org/abs/1707.06887 <br> Please note: The 2 dimensional image state requires a lot of memory capacity (~50GB) due to the buffer size of 1,000,000 as in DQN paper. So, one might want to train an a...
github_jupyter
#Document retrieval from wikipedia data #Fire up GraphLab Create ``` import graphlab ``` #Load some text data - from wikipedia, pages on people ``` people = graphlab.SFrame('people_wiki.gl/') ``` Data contains: link to wikipedia article, name of person, text of article. ``` people.head() len(people) ``` #Explor...
github_jupyter
# Bootstrap ## Import and settings In this example, we need to import `numpy`, `pandas`, and `graphviz` in addition to `lingam`. ``` import numpy as np import pandas as pd import graphviz import lingam from lingam.utils import print_causal_directions, print_dagc, make_dot print([np.__version__, pd.__version__, graph...
github_jupyter
``` # HIDDEN from datascience import * from prob140 import * import numpy as np import matplotlib.pyplot as plt plt.style.use('fivethirtyeight') %matplotlib inline from scipy import stats ``` ## Sums of IID Samples ## After the dry, algebraic discussion of the previous section it is a relief to finally be able to com...
github_jupyter
# RadarCOVID-Report ## Data Extraction ``` import datetime import logging import os import shutil import tempfile import textwrap import uuid import dataframe_image as dfi import matplotlib.ticker import numpy as np import pandas as pd import seaborn as sns %matplotlib inline sns.set() matplotlib.rcParams['figure.f...
github_jupyter
``` import tensorflow as tf from tensorflow.keras.preprocessing.image import load_img, img_to_array from tensorflow.keras.models import Sequential, load_model from tensorflow.keras.layers import Dense, Flatten, Conv2D, MaxPooling2D from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping import os import n...
github_jupyter
<img align="right" src="images/tf-small.png" width="128"/> <img align="right" src="images/phblogo.png" width="128"/> <img align="right" src="images/dans.png"/> --- Start with [convert](https://nbviewer.jupyter.org/github/annotation/banks/blob/master/programs/convert.ipynb) --- # Getting data from online repos We sh...
github_jupyter
``` #hide from fastscript.core import * ``` # fastscript > A fast way to turn your python function into a script. Part of [fast.ai](https://www.fast.ai)'s toolkit for delightful developer experiences. Written by Jeremy Howard. ## Install `pip install fastscript` ## Overview Sometimes, you want to create a quick ...
github_jupyter
# Text Mining DocSouth Slave Narrative Archive --- *Note:* This is the first in [a series of documents and notebooks](https://jeddobson.github.io/textmining-docsouth/) that will document and evaluate various machine learning and text mining tools for use in literary studies. These notebooks form the practical and crit...
github_jupyter
This dataset is derived from [Kaggle Website](https://www.kaggle.com/lakshmi25npathi/imdb-dataset-of-50k-movie-reviews/downloads/imdb-dataset-of-50k-movie-reviews.zip/1)! ------------------------------------------- ``` import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt imp...
github_jupyter
# Predict Fraud transaction 1. In this document, I will use the transaction data, which include details about each transaction, to predict whether this transaction is fraud or not. The model will be able to applied to future transaction data. 2. I will visualize the data and perform data cleaning before building the fr...
github_jupyter
**Training a RNN to synthesize English text character by character** Herein I have trained a vanilla RNN with outputs using the text from the book The Globlet of Fire by J.K. Rowling.* The following implementation will train a recurrent neural network (RNN) that shows how the evolution of the text synthesized by my ...
github_jupyter
``` %matplotlib inline ``` # Use source space morphing This example shows how to use source space morphing (as opposed to SourceEstimate morphing) to create data that can be compared between subjects. <div class="alert alert-danger"><h4>Warning</h4><p>Source space morphing will likely lead to source spaces that ar...
github_jupyter
# MLP Classification with SUBJ Dataset <hr> We will build a text classification model using MLP model on the SUBJ Dataset. Since there is no standard train/test split for this dataset, we will use 10-Fold Cross Validation (CV). ## Load the library ``` import tensorflow as tf import pandas as pd import numpy as np i...
github_jupyter
## install prerequisite ``` from utility.preprocessing1 import processing,load_pickle,get_augmentaion,train_test_split from models.model1 import padding,train_model,load_model,infer,DiagnosisDataset DATA_SIZE=10000 BASE_PATH=f'data/{DATA_SIZE}' FILE = f"{BASE_PATH}/AdmissionsDiagnosesCorePopulatedTable.txt" ``` ## Ru...
github_jupyter
``` !pip install exoplanet import exoplanet as xo exoplanet.utils.docs_setup() print(f"exoplanet.__version__ = '{exoplanet.__version__}'") !pip install lightkurve import numpy as np import lightkurve as lk import matplotlib.pyplot as plt from astropy.io import fits #1 Download TPF lc_file = lk.search_lightcurve('WAS...
github_jupyter
## 1. The NIST Special Publication 800-63B <p>If you – 50 years ago – needed to come up with a secret password you were probably part of a secret espionage organization or (more likely) you were pretending to be a spy when playing as a kid. Today, many of us are forced to come up with new passwords <em>all the time</em...
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
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Get-information-from-GFF-file" data-toc-modified-id="Get-information-from-GFF-file-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Get information from GFF file</a></span><ul class="toc-item"><li><span><a...
github_jupyter
``` from torchvision import transforms from torch.utils.data import Dataset, DataLoader import torch from torch import optim from torch.autograd import Variable import numpy as np import os import math from torch import nn from sklearn.metrics import confusion_matrix import matplotlib.pyplot as plt import itertools i...
github_jupyter
# Facial Keypoint Detection This project will be all about defining and training a convolutional neural network to perform facial keypoint detection, and using computer vision techniques to transform images of faces. The first step in any challenge like this will be to load and visualize the data you'll be working ...
github_jupyter
# Simple Use Cases Simulus is a discrete-event simulator in Python. This document is to demonstrate how to run simulus via a few examples. This is not a tutorial. For that, use [Simulus Tutorial](simulus-tutorial.ipynb). All the examples shown in this guide can be found under the `examples/demos` directory in the simu...
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
<a href="https://colab.research.google.com/github/hBar2013/DS-Unit-1-Sprint-4-Statistical-Tests-and-Experiments/blob/master/module2-intermediate-linear-algebra/Kim_Lowry_Intermediate_Linear_Algebra_Assignment.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"...
github_jupyter
``` %matplotlib inline import adaptive import matplotlib.pyplot as plt import pycqed as pq import numpy as np from pycqed.measurement import measurement_control import pycqed.measurement.detector_functions as det from qcodes import station station = station.Station() ``` ## Setting up the mock device Measurements are...
github_jupyter
``` import numpy as np import pandas as pd import time import psutil import matplotlib.pyplot as plt import numpy as np # We create a very simple data set with 5 data items in it. size= 5 # mu, sigma = 100, 5000 # mean and standard deviation # error=np.random.normal(mu, sigma, size) x1 = np.arange(0, size) # x2 = n...
github_jupyter
## Purpose: Get the stats for pitching per year (1876-2019). ``` # import dependencies. import time import pandas as pd from splinter import Browser from bs4 import BeautifulSoup as bs !which chromedriver # set up driver. executable_path = {"executable_path": "/usr/local/bin/chromedriver"} browser = Browser("chrome", ...
github_jupyter
<div class="alert alert-block alert-info"> <font size="6"><b><center> Section 2</font></center> <br> <font size="6"><b><center> Fully-Connected, Feed-Forward Neural Network Examples </font></center> </div> # Example 1: A feedforward network with one hidden layer using torch.nn and simulated data In developing (and tr...
github_jupyter
# Convolution Nets for MNIST ### TelescopeUser: 10-class classification problem <img src="imgs/mnist_plot.png" style="float: left; margin-right: 1px;" width="500" height="400" /> Deep Learning models can take quite a bit of time to run, particularly if GPU isn't used. In the interest of time, you could sample...
github_jupyter
# Exploring datastructures for dataset A Pandas exploration. Find the best datastructure to explore and transform the dataset (both training and test dataframes). Use case: - find all numerical features (filtering) - transform all numerical features (e.g. take square) - replace NaN values for a numerical feature - plot...
github_jupyter
``` """ You can run either this notebook locally (if you have all the dependencies and a GPU) or on Google Colab. Instructions for setting up Colab are as follows: 1. Open a new Python 3 notebook. 2. Import this notebook from GitHub (File -> Upload Notebook -> "GITHUB" tab -> copy/paste GitHub URL) 3. Connect to an in...
github_jupyter
**Jupyter** allows you to write and run Python code through an interactive web browser interface. Each Jupyter **notebook** is a series of **cells** that can have Python code or text. The cell below contains Python code to carry out some simple arithmatic. You can run the code by selecting the cell and holding _shift...
github_jupyter
## 10.4 딥러닝 기반 Q-Learning을 이용하는 강화학습 - 관련 패키지 불러오기 ``` # 기본 패키지 import numpy as np import random from collections import deque import matplotlib.pyplot as plt # 강화학습 환경 패키지 import gym # 인공지능 패키지: 텐서플로, 케라스 # 호환성을 위해 텐스플로에 포함된 케라스를 불러옴 import tensorflow as tf # v2.4.1 at 7/25/2021 from tensorflow import keras # v2.4...
github_jupyter
#1. Install Dependencies First install the libraries needed to execute recipes, this only needs to be done once, then click play. ``` !pip install git+https://github.com/google/starthinker ``` #2. Get Cloud Project ID To run this recipe [requires a Google Cloud Project](https://github.com/google/starthinker/blob/mast...
github_jupyter
``` import time import pandas as pd import numpy as np from keras.layers.core import Dense, Activation, Dropout from keras.layers.recurrent import LSTM from keras.models import Sequential from sklearn.metrics import mean_squared_error from sklearn.utils import shuffle from sklearn.preprocessing import MinMaxScaler fr...
github_jupyter
# **Swin Transformer: Hierarchical Vision Transformer using Shifted Windows** **Swin Transformer (ICCV 2021 best paper award (Marr Prize))** **Authors {v-zeliu1,v-yutlin,yuecao,hanhu,v-yixwe,zhez,stevelin,bainguo}@microsoft.com** **Official Github**: https://github.com/microsoft/Swin-Transformer --- **Edited By Su...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '2' import pickle import numpy as np import pandas as pd import skimage.io as io import matplotlib.pyplot as plt %matplotlib inline import tensorflow as tf import keras from keras.applications import ResNet50 from keras.applications.resnet50 import preprocess_input fr...
github_jupyter
``` import os os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = '/home/husein/t5/prepare/mesolitica-tpu.json' os.environ['CUDA_VISIBLE_DEVICES'] = '' from bigbird import modeling from bigbird import utils import tensorflow as tf import numpy as np import sentencepiece as spm vocab = '/home/husein/b2b/sp10m.cased.t5.mode...
github_jupyter
# Objective Import the FAF freight matrices provided with FAF into AequilibraE's matrix format ## Input data * FAF: https://faf.ornl.gov/fafweb/ * Matrices: https://faf.ornl.gov/fafweb/Data/FAF4.4_HiLoForecasts.zip * Zones System: http://www.census.gov/econ/cfs/AboutGeographyFiles/CFS_AREA_shapefile_010215.zip * FAF ...
github_jupyter
## House Prices: Advanced Regression Techniques : Kaggle Competition ### Import Libraries ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns ``` ### Import Data ``` test_df=pd.read_csv('test.csv') test_df.head() test_df.shape ``` ### Step1: Check for missing values ``...
github_jupyter
## Introduction to Tasks with States Task might be run for a single set of input values or we can generate multiple sets, that will be called "states". If we want to run our `Task` multiple times we have to provide input that is iterable and specify the way we want to map values of the inputs to the specific states. I...
github_jupyter
``` import jax.numpy as jnp from jax import jit, grad, jvp, random from jax.scipy.stats import multivariate_normal as mvn from jax.scipy.stats import norm from scipy.optimize import minimize, NonlinearConstraint from itertools import product from jax.config import config config.update('jax_enable_x64', True) import ...
github_jupyter
<a href="https://colab.research.google.com/github/Bluelord/ML_Mastery_Python/blob/main/06_Feature_Selection.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Feature Selction --- ``` from google.colab import drive drive.mount('/content/drive') ```...
github_jupyter
``` import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from torch.utils.data import TensorDataset, DataLoader import os import timm from tqdm.notebook import tqdm import matplotlib.pyplot as plt import torch.nn as nn #define variables specific to this model subject = 'sub01' roi = 'F...
github_jupyter
``` %matplotlib widget import os import sys sys.path.insert(0, os.getenv('HOME')+'/pycode/MscThesis/') import pandas as pd from amftrack.util import get_dates_datetime, get_dirname, get_plate_number, get_postion_number,get_begin_index import ast from amftrack.plotutil import plot_t_tp1 from scipy import sparse fro...
github_jupyter
``` import pandas as pd import numpy as np from sklearn.model_selection import train_test_split import seaborn as sns import matplotlib.pyplot as plt from sklearn.neighbors import KNeighborsClassifier from sklearn.preprocessing import LabelEncoder from sklearn.metrics import accuracy_score from sklearn.metrics import c...
github_jupyter
# Analysing the Stroop Effect ## Introduction The aim of this project was to investigate a classic phenomenon from experimental psychology called the Stroop Effect. The Stroop Effect is a demonstration of interference in the reaction time of a task. The Stroop task investigated for this project was a list of congru...
github_jupyter
``` import tensorflow as tf from bayes_tec.bayes_opt.maximum_likelihood_tec import * import numpy as np float_type = tf.float64 def test_solve(): import numpy as np from seaborn import jointplot import pylab as plt plt.style.use('ggplot') freqs = np.linspace(120e6,160e6,20) tec_conversion ...
github_jupyter
<a href="https://colab.research.google.com/github/strangelycutlemon/DS-Unit-1-Sprint-2-Data-Wrangling-and-Storytelling/blob/master/module4-sequence-your-narrative/LS_DS_124_Sequence_your_narrative_Assignment.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/...
github_jupyter
# Data Labelling Analysis (DLA) Dataset C ``` #import libraries import warnings warnings.filterwarnings("ignore") import numpy as np import pandas as pd from matplotlib import pyplot as plt import os print('Libraries imported!!') #define directory of functions and actual directory HOME_PATH = '' #home path of the proj...
github_jupyter
### Problem Statement Given a linked list with integer data, arrange the elements in such a manner that all nodes with even numbers are placed after odd numbers. **Do not create any new nodes and avoid using any other data structure. The relative order of even and odd elements must not change.** **Example:** * `link...
github_jupyter
# Validation This notebook contains examples of some of the simulations that have been used to validate Disimpy's functionality by comparing the simulated signals to analytical solutions and signals generated by other simulators. Here, we simulate free diffusion and restricted diffusion inside cylinders and spheres. ...
github_jupyter
``` !wget -q https://raw.githubusercontent.com/mannefedov/compling_nlp_hse_course/master/data/zhivago.txt !ls -lh import re import string from collections import Counter import razdel import nltk import rusenttokenize from pymystem3 import Mystem from pymorphy2 import MorphAnalyzer from nltk.stem.snowball import Sno...
github_jupyter
## Dependencies ``` import json, warnings, shutil from jigsaw_utility_scripts import * from transformers import TFXLMRobertaModel, XLMRobertaConfig from tensorflow.keras.models import Model from tensorflow.keras import optimizers, metrics, losses, layers from tensorflow.keras.callbacks import EarlyStopping, ModelCheck...
github_jupyter
# MovieLens ##DUE APRIL 21, 2016 [MovieLens](http://www.movielens.org/) is a website where users can submit ratings for movies that they watch and receive recommendations for other movies they might enjoy. The data is collected and made publicly available for research. We will be working with a data set of 1 million ...
github_jupyter