code
stringlengths
2.5k
150k
kind
stringclasses
1 value
``` %run ../setup/nb_setup %matplotlib inline ``` # Compute a Galactic orbit for a star using Gaia data Author(s): Adrian Price-Whelan ## Learning goals In this tutorial, we will retrieve the sky coordinates, astrometry, and radial velocity for a star — [Kepler-444](https://en.wikipedia.org/wiki/Kepler-444) — and ...
github_jupyter
``` import os import tarfile import urllib DOWNLOAD_ROOT = "https://raw.githubusercontent.com/ageron/handson-ml2/master/" HOUSING_PATH = os.path.join("datasets","housing") HOUSING_URL = DOWNLOAD_ROOT + "datasets/housing/housing.tgz" def fetch_housing_data(housing_url = HOUSING_URL,housing_path = HOUSING_PATH): os.m...
github_jupyter
# Image Denoising with Autoencoders ## Introduction and Importing Libraries ___ Note: If you are starting the notebook from this task, you can run cells from all previous tasks in the kernel by going to the top menu and then selecting Kernel > Restart and Run All ___ ``` import numpy as np from tensorflow.keras.data...
github_jupyter
# Lab 04 : Train vanilla neural network -- solution # Training a one-layer net on FASHION-MNIST ``` # For Google Colaboratory import sys, os if 'google.colab' in sys.modules: from google.colab import drive drive.mount('/content/gdrive') file_name = 'train_vanilla_nn_solution.ipynb' import subprocess...
github_jupyter
<a href="https://colab.research.google.com/github/TerradasExatas/IA_e_Machine_Learning/blob/main/IA_ConvNN_classificacao_MNIST.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` #https://machinelearningmastery.com/how-to-develop-a-convolutional-neu...
github_jupyter
``` from pandas import read_csv import cv2 import glob import os import numpy as np import logging import coloredlogs logger = logging.getLogger(__name__) coloredlogs.install(level='DEBUG') coloredlogs.install(level='DEBUG', logger=logger) IM_EXTENSIONS = ['png', 'jpg', 'jpeg', 'bmp'] def read_img(img_path, img_shape=(...
github_jupyter
<font color = "mediumblue">Note: Notebook was updated July 2, 2019 with bug fixes.</font> #### If you were working on the older version: * Please click on the "Coursera" icon in the top right to open up the folder directory. * Navigate to the folder: Week 3/ Planar data classification with one hidden layer. You ca...
github_jupyter
<a href="https://cognitiveclass.ai/"> <img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/PY0101EN/Ad/CCLog.png" width="200" align="center"> </a> <h1>2D <code>Numpy</code> in Python</h1> <p><strong>Welcome!</strong> This notebook will teach you about using <code>Numpy</code>...
github_jupyter
``` import scipy.special as sps import pyro import pyro.distributions as dist import torch from torch.distributions import constraints from pyro.infer import MCMC, NUTS from scipy.stats import norm from torch import nn from pyro.infer.autoguide import AutoDiagonalNormal from pyro.nn import PyroModule from pyro import ...
github_jupyter
``` import pdfkit from string import Template import numpy as np from PyPDF2 import PdfFileReader, PdfFileMerger import glob temp_address = r'C:\Users\Ol\Documents\EXPERIMENTS\ACT_ID\Materials\projectsListTemp_pl.html' # Import content with open(r'C:\Users\Ol\Documents\EXPERIMENTS\ACT_ID\Materials\progs_.txt', 'r', en...
github_jupyter
``` %matplotlib inline ``` # About Dipoles in MEG and EEG For an explanation of what is going on in the demo and background information about magentoencephalography (MEG) and electroencephalography (EEG) in general, let's walk through some code. To execute this code, you'll need to have a working version of python ...
github_jupyter
# Segmentation This notebook shows how to use Stardist (Object Detection with Star-convex Shapes) as a part of a segmentation-classification-tracking analysis pipeline. The sections of this notebook are as follows: 1. Load images 2. Load model of choice and segment an initial image to test Stardist parameters 3. B...
github_jupyter
# Introduction to Language Processing Concepts ### Original tutorial by Brain Lehman, with updates by Fiona Pigott The goal of this tutorial is to introduce a few basical vocabularies, ideas, and Python libraries for thinking about topic modeling, in order to make sure that we have a good set of vocabulary to talk mor...
github_jupyter
<a href="https://colab.research.google.com/github/saanaz379/user-comment-classifier/blob/main/solution_1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> This is the first of three solutions to identify offensive language or hate speech in a set of u...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W1D3_ModelFitting/W1D3_Tutorial3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neuromatch Academy: Week 1, Day 3, Tutorial 3 # Model Fittin...
github_jupyter
## Dependencies ``` import warnings, math, json, glob import pandas as pd import tensorflow.keras.layers as L import tensorflow.keras.backend as K from tensorflow.keras import Model from transformers import TFAutoModelForSequenceClassification, TFAutoModel, AutoTokenizer from commonlit_scripts import * seed = 0 seed...
github_jupyter
# Load raw data ``` import numpy as np data = np.loadtxt('SlowSteps1.csv', delimiter = ',') # load the raw data, change the filename as required! ``` # Find spikes ``` time_s = (data[:,8]-data[0,8])/1000000 # set the timing array to seconds and subtract 1st entry to zero it n_spikes = 0 spike_times = [] # in seconds...
github_jupyter
# Convolutional Neural Networks: Step by Step Welcome to Course 4's first assignment! In this assignment, you will implement convolutional (CONV) and pooling (POOL) layers in numpy, including both forward propagation and (optionally) backward propagation. By the end of this notebook, you'll be able to: * Explain t...
github_jupyter
# Choosing the number of segments - Elbow chart method This document illustrates how to decide the number of segments (optimal $k$) using elbow charts. ## Introducing elbow chart method **When we should (not) add more clusters**: Ideally, the lower the $SSE$ is, the better is the clustering. Although adding more cl...
github_jupyter
# DIMAML for Autoencoder models Training is on Celeba. Evaluation is on Tiny ImageNet ``` %load_ext autoreload %autoreload 2 %env CUDA_VISIBLE_DEVICES=0 import os, sys, time sys.path.insert(0, '..') import lib import math import numpy as np from copy import deepcopy import torch, torch.nn as nn import torch.nn.funct...
github_jupyter
# Autonomous Driving - Car Detection Welcome to the Week 3 programming assignment! In this notebook, you'll implement 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 Far...
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
``` # Header starts here. from sympy.physics.units import * from sympy import * # Rounding: import decimal from decimal import Decimal as DX from copy import deepcopy def iso_round(obj, pv, rounding=decimal.ROUND_HALF_EVEN): import sympy """ Rounding acc. to DIN EN ISO 80000-1:2013-08 place value = Run...
github_jupyter
# Introduction to programming for Geoscientists through Python ### [Gerard Gorman](http://www.imperial.ac.uk/people/g.gorman), [Nicolas Barral](http://www.imperial.ac.uk/people/n.barral) # Lecture 6: Files, strings, and dictionaries Learning objectives: You will learn how to: * Read data in from a file * Parse strin...
github_jupyter
``` #@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 agreed to in writing, software # distributed u...
github_jupyter
``` %matplotlib inline from matplotlib import style style.use('fivethirtyeight') import matplotlib.pyplot as plt import numpy as np import pandas as pd import datetime as dt ``` # Reflect Tables into SQLAlchemy ORM ``` # Python SQL toolkit and Object Relational Mapper import sqlalchemy from sqlalchemy.ext.automap imp...
github_jupyter
# Remote Sensing Hands-On Lesson, using TGO EPSC Conference, Berlin, September 18, 2018 ## Overview In this lesson you will develop a series of simple programs that demonstrate the usage of SpiceyPy to compute a variety of different geometric quantities applicable to experiments carried out by a r...
github_jupyter
``` import numpy from context import vaeqst import numpy from context import base base.RandomCliffordGate(0,1) ``` # Random Clifford Circuit ## RandomCliffordGate `RandomClifordGate(*qubits)` represents a random Clifford gate acting on a set of qubits. There is no further parameter to specify, as it is not any parti...
github_jupyter
<div style="text-align:center;"> <img alt="" <img src="./images/logo_default.png"/><br/> </div> <h2 style="color: #6b4e3d;">Amicable numbers</h2> <div id="problem_info" style="font-family: Consolas;"><h3>Problem 21</h3></div> <div class="problem_content" role="problem" style='background-color: #fff; color: #111; paddi...
github_jupyter
<font size=6> <b>Curso de Programación en Python</b> </font> <font size=4> Curso de formación interna, CIEMAT. <br/> Madrid, Octubre de 2021 Antonio Delgado Peris </font> https://github.com/andelpe/curso-intro-python/ <br/> # Tema 9 - El ecosistema Python: librería estándar y otros paquetes populares ## Obj...
github_jupyter
# Acknowledgement **Origine:** This notebook is downloaded at https://github.com/justmarkham/scikit-learn-videos. Some modifications are done. ## Agenda 1. K-nearest neighbors (KNN) classification 2. Logistic Regression 3. Review of model evaluation 4. Classification accuracy 5. Confusion matrix 6. Adjusting the c...
github_jupyter
<a href="https://colab.research.google.com/github/google/evojax/blob/main/examples/notebooks/TutorialTaskImplementation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Tutorial: Creating Tasks ## Pre-requisite Before we start, we need to install...
github_jupyter
# Categorical encoders Examples of how to use the different categorical encoders using the Titanic dataset. ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from feature_engine import categorical_encoders as ce from feature_engine.missin...
github_jupyter
``` __author__ = 'Mike Fitzpatrick <mike.fitzpatrick@noirlab.edu>, Robert Nikutta <robert.nikutta@noirlab.edu>' __version__ = '20211130' __datasets__ = [] __keywords__ = [] ``` ## How to use the Data Lab *Store Client* Service This notebook documents how to use the Data Lab virtual storage system via the store client...
github_jupyter
# *Bosonic statistics and the Bose-Einstein condensation* `Doruk Efe Gökmen -- 30/08/2018 -- Ankara` ## Non-interacting ideal bosons Non-interacting bosons is the only system in physics that can undergo a phase transition without mutual interactions between its components. Let us enumerate the energy eigenstates of ...
github_jupyter
# Working with 3D city models in Python **Balázs Dukai** [*@BalazsDukai*](https://twitter.com/balazsdukai), **FOSS4G 2019** Tweet <span style="color:blue">#CityJSON</span> [3D geoinformation research group, TU Delft, Netherlands](https://3d.bk.tudelft.nl/) ![](figures/logos.png) Repo of this talk: [https://githu...
github_jupyter
# Working With TileMatrixSets (other than WebMercator) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/developmentseed/titiler/master?filepath=docs%2Fexamples%2FWorking_with_nonWebMercatorTMS.ipynb) TiTiler has builtin support for serving tiles in multiple Projections by using [rio-tiler]...
github_jupyter
# 100 pandas puzzles Inspired by [100 Numpy exerises](https://github.com/rougier/numpy-100), here are 100* short puzzles for testing your knowledge of [pandas'](http://pandas.pydata.org/) power. Since pandas is a large library with many different specialist features and functions, these excercises focus mainly on the...
github_jupyter
<a href="https://colab.research.google.com/github/rjrahul24/ai-with-python-series/blob/main/01.%20Getting%20Started%20with%20Python/Python_Revision_and_Statistical_Methods.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> **Inheritence in Python** Ob...
github_jupyter
``` import pandas as pd import numpy as np import dask.array as da import dask.dataframe as dd import time import math from netCDF4 import Dataset import os,datetime,sys,fnmatch import h5py from dask.distributed import Client, LocalCluster cluster = LocalCluster() client = Client(cluster) client %%time def read_fileli...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set_style("white") #x_size, y_size = 12,8 plt.rcParams.update({'font.size': 12}) df = pd.read_csv("regression_results.csv") f = open("data\\counters_per_route.txt", encoding="utf8") routes = [] for l in f: if l.sta...
github_jupyter
# Sentiment Analysis ## Using XGBoost in SageMaker _Deep Learning Nanodegree Program | Deployment_ --- In this example of using Amazon's SageMaker service we will construct a random tree model to predict the sentiment of a movie review. You may have seen a version of this example in a pervious lesson although it wo...
github_jupyter
``` import numpy as np numbers=np.array([4,6,9.5]) numbers conda install -c plotly plotly numbers2=np.array([[1,2,3],[4,5,6]]) numbers2 numbers3=np.array([[2,'d',4],[4,'g',6]]) numbers3 evens=np.array([2*i for i in range(1,11)]) evens evens = np.array([x for x in range(2,21,2)]) evens three = np.array([[x for x in rang...
github_jupyter
# Continuous Control --- In this notebook, you will learn how to use the Unity ML-Agents environment for the second project of the [Deep Reinforcement Learning Nanodegree](https://www.udacity.com/course/deep-reinforcement-learning-nanodegree--nd893) program. ### 1. Start the Environment We begin by importing the ne...
github_jupyter
``` def download(url, params={}, retries=3): resp = None header = {"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36"} try: resp = requests.get(url, params=params, headers = header) resp.raise_for_stat...
github_jupyter
``` %matplotlib inline ``` # Species distribution modeling Modeling species' geographic distributions is an important problem in conservation biology. In this example we model the geographic distribution of two south american mammals given past observations and 14 environmental variables. Since we have only positiv...
github_jupyter
``` from ipywidgets import interact, interactive, fixed, interact_manual import ipywidgets as widgets import matplotlib.pyplot as plt from matplotlib.patches import Polygon import matplotlib.cm as cm import matplotlib from mpl_toolkits.mplot3d import Axes3D from mpl_toolkits.mplot3d.art3d import Poly3DCollection %mat...
github_jupyter
``` %pushd ../../ %env CUDA_VISIBLE_DEVICES=3 import json import os import sys import tempfile from tqdm.auto import tqdm import torch import torchvision from torchvision import transforms from PIL import Image import numpy as np torch.cuda.set_device(0) from netdissect import setting segopts = 'netpqc' segmodel, se...
github_jupyter
# Introduction to the Python language **Note**: This notebooks is not really a ready-to-use tutorial but rather serves as a table of contents that we will fill during the short course. It might later be useful as a memo, but it clearly lacks important notes and explanations. There are lots of tutorials that you can f...
github_jupyter
# 14 - Introduction to Deep Learning by [Alejandro Correa Bahnsen](albahnsen.com/) version 0.1, May 2016 ## Part of the class [Machine Learning Applied to Risk Management](https://github.com/albahnsen/ML_RiskManagement) This notebook is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported Licen...
github_jupyter
``` import numpy as np import pandas as pd import tensorflow as tf from tensorflow.keras.preprocessing import image import numpy as np import tensorflow as tf from tensorflow import keras import warnings; warnings.filterwarnings('ignore') ``` # Predict batches of images ``` tf.compat.v1.enable_v2_behavior...
github_jupyter
# ML Project 6033657523 - Feedforward neural network ## Importing the libraries ``` from sklearn.metrics import mean_absolute_error from sklearn.svm import SVR from sklearn.model_selection import KFold, train_test_split from math import sqrt import pandas as pd import numpy as np from sklearn.metrics import mean_squa...
github_jupyter
# Transfer Learning Most of the time you won't want to train a whole convolutional network yourself. Modern ConvNets training on huge datasets like ImageNet take weeks on multiple GPUs. Instead, most people use a pretrained network either as a fixed feature extractor, or as an initial network to fine tune. In this not...
github_jupyter
``` import tensorflow as tf from keras.applications.resnet50 import ResNet50 from keras.preprocessing import image from keras.applications.resnet50 import preprocess_input from keras.models import Model import numpy as np base_model=ResNet50(weights="imagenet") model=Model(inputs=base_model.input, outputs=base_model.g...
github_jupyter
# Introduction to Programming Topics for today will include: - Mozilla Developer Network [(MDN)](https://developer.mozilla.org/en-US/) - Python Documentation [(Official Documentation)](https://docs.python.org/3/) - Importance of Design - Functions - Built in Functions ## Mozilla Developer Network [(MDN)](https://deve...
github_jupyter
``` !conda info ``` # Variables ``` x = 2 y = '3' print(x+int(y)) z = [1, 2, 3] #List w = (2, 3, 4) #Tuple import numpy as np q = np.array([1, 2, 3]) #numpy.ndarray type(q) ``` # Console input and output ``` MyName = input('My name is: ') print('Hello, '+MyName) ``` # File input and output ``` fid = open('msg.t...
github_jupyter
# PyFunc Model + Transformer Example This notebook demonstrates how to deploy a Python function based model and a custom transformer. This type of model is useful as user would be able to define their own logic inside the model as long as it satisfy contract given in `merlin.PyFuncModel`. If the pre/post-processing st...
github_jupyter
<a href="https://colab.research.google.com/github/mghendi/smartphonepriceclassifier/blob/main/CCI_501_ML_Project.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## CCI501 - Machine Learning Project ### Name: Samuel Mwamburi Mghendi ### Admission ...
github_jupyter
# PROYECTO CIFAR-10 ## CARLOS CABAÑÓ ## 1. Librerias Descargamos la librería para los arrays en preprocesamiento de Keras ``` from tensorflow import keras as ks from matplotlib import pyplot as plt import numpy as np import time import datetime import random from sklearn.preprocessing import LabelEncoder from ten...
github_jupyter
``` __author__ = "Jithin Pradeep" __copyright__ = "Copyright (C) 2018 Jithin Pradeep" __license__ = "MIT License" __version__ = "1.0" ``` # Summary ## About the Dataset The data files train.csv and test.csv contain gray-scale images of hand-drawn digits, from zero through nine. Each image is 28 pixels in height and...
github_jupyter
## plan_pole_transect Visualize pole locations on Pea Island beach transect. Profiles were extracted from SfM maps by Jenna on 31 August 2021 - Provisional Data. #### Read in profiles Use pandas to read profiles; pull out arrays of x, y (UTM meters, same for all profiles) and z (m NAVD88). Calculate distance along...
github_jupyter
``` import pandas as pd import numpy as np import warnings warnings.filterwarnings('ignore') import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline sns.set(style='white', color_codes=True) dataset = pd.read_csv("/content/drive/MyDrive/Colab Notebooks/ortho_knnnb.csv") dataset.head() print("Dimension...
github_jupyter
# Analysis of how mentions of a stock on WSB relates to stock prices WallStreetBets is a popular forum on reddit known for going to the moon, apes and stonks. Jokes aside, despite all of the ridiculous bad trades, undecipherable jargon and love for memes, it's effect on the stock market is undeniable. Therefore in thi...
github_jupyter
# NumPy arrays Nikolay Koldunov koldunovn@gmail.com This is part of [**Python for Geosciences**](https://github.com/koldunovn/python_for_geosciences) notes. ================ <img height="100" src="files/numpy.png" > - a powerful N-dimensional array object - sophisticated (broadcasting) functions - tools...
github_jupyter
<a href="https://colab.research.google.com/github/moonryul/course-v3/blob/master/MidTermPart2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Creating your own dataset from Google Images *by: Francisco Ingham and Jeremy Howard. Inspired by [Adria...
github_jupyter
<img src="http://hilpisch.com/tpq_logo.png" alt="The Python Quants" width="35%" align="right" border="0"><br> # Python for Finance (2nd ed.) **Mastering Data-Driven Finance** &copy; Dr. Yves J. Hilpisch | The Python Quants GmbH <img src="http://hilpisch.com/images/py4fi_2nd_shadow.png" width="300px" align="left"> ...
github_jupyter
## RAC/DVR step 1: diagonalize **H**($\lambda$) ``` import numpy as np import sys import matplotlib.pyplot as plt %matplotlib qt5 import pandas as pd # # extend path by location of the dvr package # sys.path.append('../../Python_libs') import dvr import jolanta amu_to_au=1822.888486192 au2cm=219474.63068 au2eV=27.211...
github_jupyter
Deep Learning ============= Assignment 4 ------------ Previously in `2_fullyconnected.ipynb` and `3_regularization.ipynb`, we trained fully connected networks to classify [notMNIST](http://yaroslavvb.blogspot.com/2011/09/notmnist-dataset.html) characters. The goal of this assignment is make the neural network convol...
github_jupyter
``` # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import warnings import ipdb import dan_utils warnings.filterwarnings("ignore") from statsmodels.graphics.tsaplots import plot_acf from statsmodels.graphics.tsaplots import plot_pacf from statsmodels.tsa.stattools import adfuller as ADF from sta...
github_jupyter
# STEP 4 - Making DRL PySC2 Agent ``` %load_ext autoreload %autoreload 2 import sys; sys.path.append('..') ### unfortunately, PySC2 uses Abseil, which treats python code as if its run like an app # This does not play well with jupyter notebook # So we will need to monkeypatch sys.argv import sys #sys.argv = ["python...
github_jupyter
``` # HIDDEN from datascience import * from prob140 import * import numpy as np import matplotlib.pyplot as plt plt.style.use('fivethirtyeight') %matplotlib inline import math from scipy import stats ``` ## MGFs, the Normal, and the CLT ## Let $Z$ be standard normal. Then the mgf of $Z$ is given by $$ M_Z(t) ~ = ~ e...
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
# ENGR 1330 Exam 1 Sec 003/004 Fall 2020 Take Home Portion of Exam 1 <hr> ## Full name ## R#: ## HEX: ## ENGR 1330 Exam 1 Sec 003/004 ## Date: <hr> ## Question 1 (1 pts): Run the cell below, and leave the results in your notebook (Windows users may get an error, leave the error in place) ``` #### RUN! the Cell #### ...
github_jupyter
# 转置卷积 :label:`sec_transposed_conv` 到目前为止,我们所见到的卷积神经网络层,例如卷积层( :numref:`sec_conv_layer`)和汇聚层( :numref:`sec_pooling`),通常会减少下采样输入图像的空间维度(高和宽)。 然而如果输入和输出图像的空间维度相同,在以像素级分类的语义分割中将会很方便。 例如,输出像素所处的通道维可以保有输入像素在同一位置上的分类结果。 为了实现这一点,尤其是在空间维度被卷积神经网络层缩小后,我们可以使用另一种类型的卷积神经网络层,它可以增加上采样中间层特征图的空间维度。 在本节中,我们将介绍 *转置卷积*(transposed convol...
github_jupyter
# **LSTM - Time Series Prediction** ## **Importing libraries** ``` import pandas import matplotlib.pyplot as plt import numpy import math from tqdm import tqdm from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from tensorflow.keras.layers import LSTM from sklearn.preprocessing...
github_jupyter
``` from tensorflow import keras from tensorflow.keras import * from tensorflow.keras.models import * from tensorflow.keras.layers import * from tensorflow.keras.regularizers import l2#正则化L2 import tensorflow as tf import numpy as np import pandas as pd normal = np.loadtxt(r'F:\张老师课题学习内容\code\数据集\试验数据(包括压力脉动和振动)\2013.9...
github_jupyter
# The YUSAG Football Model by Matt Robinson, matthew.robinson@yale.edu, Yale Undergraduate Sports Analytics Group This notebook introduces the model we at the Yale Undergraduate Sports Analytics Group (YUSAG) use for our college football rankings. This specific notebook details our FBS rankings at the beginnin...
github_jupyter
### Using fmriprep [fmriprep](https://fmriprep.readthedocs.io/en/stable/) is a package developed by the Poldrack lab to do the minimal preprocessing of fMRI data required. It covers brain extraction, motion correction, field unwarping, and registration. It uses a combination of well-known software packages (e.g., FSL,...
github_jupyter
Скачайте данные в формате csv, выберите из таблицы данные по России, начиная с 3 марта 2020 г. (в этот момент впервые стало больше 2 заболевших). В качестве целевой переменной возьмём число случаев заболевания (столбцы total_cases и new_cases); для упрощения обработки можно заменить в столбце new_cases все нули на един...
github_jupyter
SVM ``` import pandas as pd from sklearn import svm, metrics from sklearn.model_selection import train_test_split wesad_eda = pd.read_csv('D:\data\wesad-chest-combined-classification-eda.csv') # need to adjust a path of dataset wesad_eda.columns original_column_list = ['MEAN', 'MAX', 'MIN', 'RANGE', 'KURT', 'SKEW', 'M...
github_jupyter
# Time series analysis on AWS *Chapter 1 - Time series analysis overview* ## Initializations --- ``` !pip install --quiet tqdm kaggle tsia ruptures ``` ### Imports ``` import matplotlib.colors as mpl_colors import matplotlib.dates as mdates import matplotlib.ticker as ticker import matplotlib.pyplot as plt import n...
github_jupyter
# MOHID visualisation tools ``` 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> <form action="javascript:code_toggle()"><inpu...
github_jupyter
## ML Lab 3 ### Neural Networks In the following exercise class we explore how to design and train neural networks in various ways. #### Prerequisites: In order to follow the exercises you need to: 1. Activate your conda environment from last week via: `source activate <env-name>` 2. Install tensorflow (https://www...
github_jupyter
# data acquisition / processing homework 2 > I pledge my Honor that I have abided by the Stevens Honor System. - Joshua Schmidt 2/27/21 ## Problem 1 a. For a stationary AR(1) time series x(t), x(t) is uncorrelated to x(t-l) for l>=2. This is false. For AR(1), $x(t) = a_0 + a_1 \cdot x(t - 1) + \epsilon_t$. In this ...
github_jupyter
## Initiate the vissim instance ``` # COM-Server import win32com.client as com import igraph import qgrid from VISSIM_helpers import VissimRoadNet from os.path import abspath, join, exists import os from shutil import copyfile import pandas as pd import math from pythoncom import com_error ``` Add autocompletion for ...
github_jupyter
## Some more on ```spaCy``` and ```pandas``` First we want to import some of the packages we need. ``` import os import spacy # Remember we need to initialise spaCy nlp = spacy.load("en_core_web_sm") ``` We can inspect this object and see that it's what we've been called a ```spaCy``` object. ``` type(nlp) ``` We...
github_jupyter
# #05 - Exploring Utils Falar sobre para se trabalhar com trajetórias pode ser necessária algumas c onversões envolvendo tempo e data, distância e etc, fora outros utilitários. Falar dos módulos presentes no pacote utils - constants - conversions - datetime - distances - math - mem - trajectories - transformations ...
github_jupyter
# Initial Modelling notebook ``` import os import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import warnings import bay12_solution_eposts as solution ``` ## Load data ``` post, thread = solution.prepare.load_dfs('train') post.head(2) thread.head(2) ``` I will set the thread...
github_jupyter
``` import numpy as np import pandas as pd import pydicom import os import random import matplotlib.pyplot as plt from tqdm import tqdm from PIL import Image from sklearn.metrics import mean_absolute_error from sklearn.model_selection import KFold import warnings warnings.filterwarnings("ignore") import torch.nn as n...
github_jupyter
``` # Import Dependencies import os import csv # Establish filepath budget_csv = os.path.join(".", "resources", "budget_data.csv") output_file = os.path.join(".", "financial_analysis.txt") # Index Reference for the Profit and Loss List # Track Financial Parameters # Open and read csv file with open(budget_csv, newlin...
github_jupyter
``` import numpy as np import pandas as pd ``` # Pandas Metodları ve Özellikleri ### Veri Analizi için Önemli Konular #### Eksik Veriler (Missing Value) ``` data = {'Istanbul':[30,29,np.nan],'Ankara':[20,np.nan,25],'Izmir':[40,39,38],'Antalya':[40,np.nan,np.nan]} weather = pd.DataFrame(data,index=['pzt','sali','car...
github_jupyter
<a href="https://colab.research.google.com/github/keivanipchihagh/Intro_To_MachineLearning/blob/master/Models/Newswires_Classification_with_Reuters.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Newswires Classification with Reuters ##### Import...
github_jupyter
# Interpreting text models: IMDB sentiment analysis This notebook loads pretrained CNN model for sentiment analysis on IMDB dataset. It makes predictions on test samples and interprets those predictions using integrated gradients method. The model was trained using an open source sentiment analysis tutorials describ...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from sklearn.preprocessing import MinMaxScaler from sklearn.metrics import mean_squared_error from sklearn.model_selection...
github_jupyter
# autotimeseries > Nixtla SDK. Time Series Forecasting pipeline at scale. [![CI python sdk](https://github.com/Nixtla/nixtla/actions/workflows/python-sdk.yml/badge.svg)](https://github.com/Nixtla/nixtla/actions/workflows/python-sdk.yml) [![Python](https://img.shields.io/pypi/pyversions/autotimeseries)](https://pypi.o...
github_jupyter
``` #!/usr/bin/env python # encoding: utf-8 """ @Author: yangwenhao @Contact: 874681044@qq.com @Software: PyCharm @File: cam_2.py @Time: 2021/4/12 21:47 @Overview: Created on 2019/8/4 上午9:37 @author: mick.yi """ import os import pdb import numpy as np import torch from torch.nn.parallel.distributed import Di...
github_jupyter
# The Structure and Geometry of the Human Brain [Noah C. Benson](https://nben.net/) &lt;[nben@uw.edu](mailto:nben@uw.edu)&gt; [eScience Institute](https://escience.washingtonn.edu/) [University of Washington](https://www.washington.edu/) [Seattle, WA 98195](https://seattle.gov/) ## Introduction This notebook i...
github_jupyter
# Baye's Theorem ### Introduction Befor starting with *Bayes Theorem* we can have a look at some definitions. **Conditional Probability :** Conditional Probability is the Probability of one event occuring with some Relationship to one or more events. Let A and B be the two interdependent event,where A has already oc...
github_jupyter
[learning-python3.ipynb]: https://gist.githubusercontent.com/kenjyco/69eeb503125035f21a9d/raw/learning-python3.ipynb Right-click -> "save link as" [https://gist.githubusercontent.com/kenjyco/69eeb503125035f21a9d/raw/learning-python3.ipynb][learning-python3.ipynb] to get most up-to-date version of this notebook file. ...
github_jupyter