code
stringlengths
2.5k
150k
kind
stringclasses
1 value
``` %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
# Photometric Plugin For optical photometry, we provide the **PhotometryLike** plugin that handles forward folding of a spectral model through filter curves. Let's have a look at the avaiable procedures. ``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline from threeML import * # we will need ...
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
``` import numpy as np import pandas as pd from matplotlib import pyplot as plt from tqdm import tqdm %matplotlib inline from torch.utils.data import Dataset, DataLoader import torch import torchvision import torch.nn as nn import torch.optim as optim from torch.nn import functional as F device = torch.device("cuda" i...
github_jupyter
# Introduction to Convolutional Neural Networks (CNNs) in PyTorch ### Representing images digitally While convolutional neural networks (CNNs) see a wide variety of uses, they were originally designed for images, and CNNs are still most commonly used for vision-related tasks. For today, we'll primarily be focusing on...
github_jupyter
``` import warnings import pandas as pd import numpy as np import os import sys # error msg import operator # sorting from math import * from read_trace import * from avgblkmodel import * warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning) ``` # gpu info ``` gtx950 = DeviceInfo() gtx950.sm_num ...
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
# Tutorial - Time Series Forecasting - Autoregression (AR) The goal is to forecast time series with the Autoregression (AR) Approach. 1) JetRail Commuter, 2) Air Passengers, 3) Function Autoregression with Air Passengers, and 5) Function Autoregression with Wine Sales. References Jason Brownlee - https://machinelearn...
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
用带有三种类型噪声(度,边权重,点权重)的传销模型网络测试RoleMagnet的抗噪性 ``` import numpy as np import networkx as nx import matplotlib.pyplot as plt ``` ## Creating a graph 模拟23人的小型传销组织,带少量噪声 ``` %matplotlib inline plt.rcParams['figure.dpi'] = 150 plt.rcParams['figure.figsize'] = (4, 3) G = nx.DiGraph() G.add_weighted_edges_from([('11','s1',0...
github_jupyter
# Tune TensorFlow Serving ## Guidelines ### CPU-only If your system is CPU-only (no GPU), then consider the following values: * `num_batch_threads` equal to the number of CPU cores * `max_batch_size` to infinity (ie. MAX_INT) * `batch_timeout_micros` to 0. Then experiment with batch_timeout_micros values in the 1-10...
github_jupyter
``` import scrublet as scr import numpy as np import pandas as pd import scanpy as sc import matplotlib.pyplot as plt import os import sys import scipy def MovePlots(plotpattern, subplotdir): os.system('mkdir -p '+str(sc.settings.figdir)+'/'+subplotdir) os.system('mv '+str(sc.settings.figdir)+'/*'+plotpattern...
github_jupyter
## The Basics At the core of Python (and any programming language) there are some key characteristics of how a program is structured that enable the proper execution of that program. These characteristics include the structure of the code itself, the core data types from which others are built, and core operators that...
github_jupyter
# Bayesian Optimization [Bayesian optimization](https://en.wikipedia.org/wiki/Bayesian_optimization) is a powerful strategy for minimizing (or maximizing) objective functions that are costly to evaluate. It is an important component of [automated machine learning](https://en.wikipedia.org/wiki/Automated_machine_learn...
github_jupyter
# UMAP This script generates UMAP representations from spectrograms (previously generated). ### Installing and loading libraries ``` import os import pandas as pd import sys import numpy as np from pandas.core.common import flatten import pickle import umap from pathlib import Path import datetime import scipy impo...
github_jupyter
There are 76,670 different agent ids in the training data. ``` import os import pickle import random import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline sns.set(rc={"figure.dpi":100, 'savefig.dpi':100}) sns.set_context('notebook') # Keys to the pickle object...
github_jupyter
# Basic Tensor operations and GradientTape. In this graded assignment, you will perform different tensor operations as well as use [GradientTape](https://www.tensorflow.org/api_docs/python/tf/GradientTape). These are important building blocks for the next parts of this course so it's important to master the basics. Le...
github_jupyter
# Exploratory Data Analysis In this notebook, I have illuminated some of the strategies that one can use to explore the data and gain some insights about it. We will start from finding metadata about the data, to determining what techniques to use, to getting some important insights about the data. This is based on t...
github_jupyter
#### Bogumiła Walkowiak bogumila.walkowiak@grenoble-inp.org #### Joachim Mąkowski joachim-kajetan.makowski@grenoble-inp.org # Intelligent Systems: Reasoning and Recognition ## Recognizing Digits using Neural Networks ## 1. Introduction <font size=4>The MNIST (Modified National Institute of Standards and Technology...
github_jupyter
``` # Copyright 2019 Google Inc. # 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,...
github_jupyter
``` import numpy as np import pandas as pd import scipy import matplotlib.pyplot as plt from sklearn.metrics import accuracy_score from datetime import datetime %matplotlib inline import matplotlib from datetime import datetime import os from scipy import stats from definitions import HUMAN_DATA_DIR, ROOT_DIR from dat...
github_jupyter
# UCI Daphnet dataset (Freezing of gait for Parkinson's disease patients) ``` import numpy as np import pandas as pd import os from typing import List from pathlib import Path from config import data_raw_folder, data_processed_folder from timeeval import Datasets import matplotlib import matplotlib.pyplot as plt %matp...
github_jupyter
#### Amy Green - 200930437 # <center> 5990M: Introduction to Programming for Geographical Information Analysis - Core Skills </center> ## <center><u> __**Assignment 2: Investigating the Black Death**__ </u></center> ------------------------------------------------------------- ### Project Aim <p>The aim of the p...
github_jupyter
# SDLib > Shilling simulated attacks and detection methods ## Setup ``` !mkdir -p results ``` ### Imports ``` from collections import defaultdict import numpy as np import random import os import os.path from os.path import abspath from os import makedirs,remove from re import compile,findall,split import matplotli...
github_jupyter
# Calculate the AMOC in density space $VVEL*DZT*DXT (x,y,z)$ -> $VVEL*DZT*DXT (x,y,$\sigma$)$ -> $\sum_{x=W}^E$ -> $\sum_{\sigma=\sigma_{max/min}}^\sigma$ ``` import os import sys import xgcm import numpy as np import xarray as xr import cmocean import pop_tools import matplotlib import matplotlib.pyplot as plt %matp...
github_jupyter
# ENGR 213 Project Demonstration: Toast Falling from Counter ## Iteration AND slipping of toast This is a Jupyter notebook created to explore the utility of notebooks as an engineering/physics tool. As I consider integrating this material into physics and engineering courses I am having a hard time clarifying the outc...
github_jupyter
# Deep learning for Natural Language Processing * Simple text representations, bag of words * Word embedding and... not just another word2vec this time * 1-dimensional convolutions for text * Aggregating several data sources "the hard way" * Solving ~somewhat~ real ML problem with ~almost~ end-to-end deep learni...
github_jupyter
# 3장 케라스와 텐서플로우 ## 주요 내용 - 딥러닝 필수 요소 - 케라스와 텐서플로우 간략 소개 - 텐서플로우, 케라스, GPU를 활용한 딥러닝 작업환경 - 케라스와 텐서플로우를 이용한 신경망의 핵심 구성요소 구현 ## 3.1 텐서플로우 소개 ### 텐서플로우 - 구글을 중심으로 개발된 머신러닝 __플랫폼__(platform) - TF-Agents: 강화학습 연구 지원 - TFX: 머신러닝 프로젝트 진행과정(workflow) 운영 지원 - TF-Hub: 훈련된 모델 제공 - 파이썬 기반 - 텐서 연산 지원 ### 넘파이(Numpy)...
github_jupyter
<h1>Linear Algebra (CpE210A) <h3>Midterms Project Coded and submitted by:<br> <i>Galario, Adrian Q.<br> 201814169 <br> 58051</i> Directions This Jupyter Notebook will serve as your base code for your Midterm Project. You must further format and provide complete discussion on the given topic. - Provide all ne...
github_jupyter
<a href="https://colab.research.google.com/github/Prady96/Pothole-Detection/blob/avi_testing/Final_file_for_tata_innoverse.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` !pip -V !python -V !pip install --upgrade youtube-dl !youtube-dl https://d...
github_jupyter
# Credit Risk Resampling Techniques ``` import warnings warnings.filterwarnings('ignore') import numpy as np import pandas as pd from pathlib import Path from collections import Counter ``` # Read the CSV into DataFrame ``` # Load the data file_path = Path('Resources/lending_data.csv') df = pd.read_csv(file_path) df...
github_jupyter
# Gráficos de desempenho das Caches ### Import libs ``` %matplotlib inline ##Bibliotecas importadas # Biblioteca usada para abrir arquivos CSV import csv # Bibilioteca para fazer leitura de datas from datetime import datetime, timedelta # Fazer o ajuste de datas no gráfico import matplotlib.dates as mdate # Bibliotec...
github_jupyter
## Loading libraries and looking at given data ``` import numpy as np import pandas as pd import seaborn as sns import re appendix_3=pd.read_excel("Appendix_3_august.xlsx") appendix_3 print(appendix_3["Language"].value_counts(),) print(appendix_3["Country"].value_counts()) pd.set_option("display.max_rows", None, "disp...
github_jupyter
# ADN Implemente un programa que identifique a una persona en función de su ADN, según se indica a continuación. <code>$ python dna.py databases/large.csv sequences/5.txt Lavender</code> ## Empezando - Dentro de la carpeta data/adn se encuentra la información necesaria para resolver este ejercicio la cual incluye u...
github_jupyter
``` import pandas as pd import numpy as np from matplotlib import pyplot as plt %matplotlib inline import matplotlib matplotlib.rcParams["figure.figsize"] = (20,10) df1 = pd.read_csv("Bengaluru_House_Data.csv") df1.head() df1.shape df1.columns df1["area_type"].unique() df1["area_type"].value_counts() # Drop features t...
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
# Implementing the Gradient Descent Algorithm In this lab, we'll implement the basic functions of the Gradient Descent algorithm to find the boundary in a small dataset. First, we'll start with some functions that will help us plot and visualize the data. ``` import matplotlib.pyplot as plt import numpy as np import ...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_parent" href="https://github.com/giswqs/geemap/tree/master/tutorials/ImageCollection/01_image_collection_overview.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target=...
github_jupyter
# Regarding this Notebook This is a replication of the original analysis performed in the paper by [Waade & Enevoldsen 2020](missing). This replication script will not be updated as it is intended for reproducibility. Any deviations from the paper is marked with bold for transparency. Footnotes and internal documentati...
github_jupyter
<a href="https://colab.research.google.com/github/robertozerbini/blog/blob/add-license-1/Roberto_Zerbini's_Blog_Polynomial_Regression.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import pandas as pd import matplotlib.pyplot as plt import nump...
github_jupyter
``` import keras from IPython.display import SVG from keras.optimizers import Adam from keras.utils.vis_utils import model_to_dot from tqdm import tqdm from keras import backend as K from keras.preprocessing.text import Tokenizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.feature_extrac...
github_jupyter
# Building the dataset In this notebook, I'm going to be working with three datasets to create the dataset that the chatbot will be trained on. ``` import pandas as pd files_path = 'D:/Sarcastic Chatbot/Input/' ``` # First dataset **The Wordball Joke Dataset**, [link](https://www.kaggle.com/bfinan/jokes-question-and...
github_jupyter
# 선형연립방정식 사례: 간단한 트러스<br>Example of Systems of Linear Equations : Simple Truss ``` # 그래프, 수학 기능 추가 # Add graph and math features import pylab as py import numpy as np import numpy.linalg as nl # 기호 연산 기능 추가 # Add symbolic operation capability import sympy as sy ``` 화살표를 그리는 함수<br>Function to draw an arrow ``` def dr...
github_jupyter
![](../graphics/solutions-microsoft-logo-small.png) # Python for Data Professionals ## 02 Programming Basics <p style="border-bottom: 1px solid lightgrey;"></p> <dl> <dt>Course Outline</dt> <dt>1 - Overview and Course Setup</dt> <dt>2 - Programming Basics <i>(This section)</i></dt> <dd>2.1 - Getting help<...
github_jupyter
# Manual Jupyter Notebook: https://athena.brynmawr.edu/jupyter/hub/dblank/public/Jupyter%20Notebook%20Users%20Manual.ipynb #Jupyter Notebook Users Manual This page describes the functionality of the [Jupyter](http://jupyter.org) electronic document system. Jupyter documents are called "notebooks" and can be seen as ...
github_jupyter
# Recommendations with IBM In this notebook, you will be putting your recommendation skills to use on real data from the IBM Watson Studio platform. You may either submit your notebook through the workspace here, or you may work from your local machine and submit through the next page. Either way assure that your ...
github_jupyter
# 0.0. IMPORTS ``` import inflection import math import datetime import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from IPython.core.display import HTML from IPython.display import Image ``` ## 0.1. Helper Functions ``` def load_csv(path):...
github_jupyter
``` import json import pandas as pd import numpy as np import re from sqlalchemy import create_engine import psycopg2 from config import db_password import time # Add the clean movie function that takes in the argument, "movie". def clean_movie(movie): movie = dict(movie) #create a non-destructive copy alt...
github_jupyter
<style type="text/css"> .tg {border-collapse:collapse;border-spacing:0;} .tg td{border-color:white;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px; overflow:hidden;padding:10px 5px;word-break:normal;} .tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sa...
github_jupyter
# LAB 4c: Create Keras Wide and Deep model. **Learning Objectives** 1. Set CSV Columns, label column, and column defaults 1. Make dataset of features and label from CSV files 1. Create input layers for raw features 1. Create feature columns for inputs 1. Create wide layer, deep dense hidden layers, and output layer ...
github_jupyter
``` import cv2 bild = cv2.imread("data\ped2//training//frames//01//000.jpg") bild2 = cv2.imread("data\ped2//training//frames//01//001.jpg") import numpy as np lista = list() lista.append(bild) lista.append(bild2) lista = np.array(lista) import cv2 import os import numpy as np bilder = list() for folder in os.listdir(...
github_jupyter
# Neural Network Example Build a 2-hidden layers fully connected neural network (a.k.a multilayer perceptron) with TensorFlow. - Author: Aymeric Damien - Project: https://github.com/aymericdamien/TensorFlow-Examples/ ## Neural Network Overview <img src="http://cs231n.github.io/assets/nn1/neural_net2.jpeg" alt="nn" ...
github_jupyter
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_10_3_text_generation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # T81-558: Applications of Deep Neural Networks **Module 10: Time Serie...
github_jupyter
``` %matplotlib inline import pandas as pd from os.path import join import seaborn as sns import matplotlib.pyplot as plt import numpy as np import skbio # from q2d2 import get_within_between_distances, filter_dm_and_map from stats import mc_t_two_sample from skbio.stats.distance import anosim, permanova from skbio.sta...
github_jupyter
## Training with Chainer [VGG](https://arxiv.org/pdf/1409.1556v6.pdf) is an architecture for deep convolution networks. In this example, we train a convolutional network to perform image classification using the CIFAR-10 dataset. CIFAR-10 consists of 60000 32x32 colour images in 10 classes, with 6000 images per class....
github_jupyter
<img src="images/utfsm.png" alt="" width="200px" align="right"/> # USM Numérica ## Tema del Notebook ### Objetivos 1. Conocer el funcionamiento de la librerìa sklearn de Machine Learning 2. Aplicar la librerìa sklearn para solucionar problemas de Machine Learning ## Sobre el autor ### Sebastián Flores #### ICM UTFSM ...
github_jupyter
``` import tensorflow as tf print(tf.__version__) import numpy as np import matplotlib.pyplot as plt def plot_series(time, series, format="-", start=0, end=None): plt.plot(time[start:end], series[start:end], format) plt.xlabel("Time") plt.ylabel("Value") plt.grid(True) #!wget --no-check-certificate \ # ...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np import h5py archive = h5py.File('/Users/bmmorris/git/aesop/notebooks/spectra.hdf5', 'r+') targets = list(archive) list(archive['HD122120'])#['2017-09-11T03:27:13.140']['flux'][:] from scipy.ndimage import gaussian_filter1d spectrum1 = archive['...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Download-and-Clean-Data" data-toc-modified-id="Download-and-Clean-Data-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Download and Clean Data</a></span></li><li><span><a href="#Making-Recommendations" da...
github_jupyter
# CI coverage, length and bias For event related design. ``` # Directories of the data for different scenario's DATAwd <- list( 'Take[8mmBox10]' = "/Volumes/2_TB_WD_Elements_10B8_Han/PhD/IBMAvsGLM/Results/Cambridge/ThirdLevel/8mm/boxcar10", 'Take[8mmEvent2]' = "/Volumes/2_TB_WD_Elements_10B8_Han/PhD/IBMAvsGLM/Resu...
github_jupyter
## Mixture Density Networks with PyTorch ## Related posts: JavaScript [implementation](http://blog.otoro.net/2015/06/14/mixture-density-networks/). TensorFlow [implementation](http://blog.otoro.net/2015/11/24/mixture-density-networks-with-tensorflow/). ``` import matplotlib.pyplot as plt import numpy as np import t...
github_jupyter
``` %load_ext autoreload %autoreload 2 import preprocess preprocess.main('CC*.pkl','BIOS.pkl') !ls import pickle all_bios = pickle.load( open( "BIOS.pkl", "rb" ) ) ``` ## Dictionary Details 1. r["title"] tells you the noramlized title 2. r["gender"] tells you the gender (binary for simplicity, determined from the p...
github_jupyter
``` #pandas #indexes are visible #2 types of data structure #1. sereis - vector - 1d #2.data framee - 2d #3. index - index is visible import numpy as np import pandas as pd #descriptive statistics data = pd.Series([0.25,0.5,0.75,1]) data data.values data.index data.shape data.describe data.describe() #explicit indexin...
github_jupyter
## Environment ``` %env CUDA_DEVICE_ORDER=PCI_BUS_ID %env CUDA_VISIBLE_DEVICES=0 from pathlib import Path import numpy as np import matplotlib.pyplot as plt %matplotlib inline %autosave 20 import csv import pandas as pd from keras.backend import tf as ktf import sys import cv2 import six # keras import keras from ke...
github_jupyter
``` import numpy as np import os import pandas as pd from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer from sklearn.metrics.classification import classification_report, accuracy_score from sklearn.model_selection import cross_val_predict from nltk.corpus import stopwords stop_words=stopwords....
github_jupyter
``` import os os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9' # HACK: needed for stan... import astropy.coordinates as coord from astropy.table import Table, join, hstack import astropy.units as u import matplotlib.pyplot as plt %matplotlib inline import numpy as np import pystan from pyia import GaiaData sm = pystan...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from tqdm import tnrange, tqdm_notebook import gc import operator sns.set_context('talk') pd.set_option('display.max_columns', 500) import warnings warnings.filterwarnings('ignore', message='Changing the ...
github_jupyter
# Test For The Best Machine Learning Algorithm For Prediction This notebook takes about 40 minutes to run, but we've already run it and saved the data for you. Please read through it, though, so that you understand how we came to the conclusions we'll use moving forward. ## Six Algorithms We're going to compare six ...
github_jupyter
# Model building https://www.kaggle.com/vadbeg/pytorch-nn-with-embeddings-and-catboost/notebook#PyTorch mostly based off this example, plus parts of code form tutorial 5 lab 3 ``` # import load_data function from %load_ext autoreload %autoreload 2 # fix system path import sys sys.path.append("/home/jovyan/work") i...
github_jupyter
* 比较不同组合组合优化器在不同规模问题上的性能; * 下面的结果主要比较``alphamind``和``python``中其他优化器的性能差别,我们将尽可能使用``cvxopt``中的优化器,其次选择``scipy``; * 由于``scipy``在``ashare_ex``上面性能太差,所以一般忽略``scipy``在这个股票池上的表现; * 时间单位都是毫秒。 * 请在环境变量中设置`DB_URI`指向数据库 ``` import os import timeit import numpy as np import pandas as pd import cvxpy from alphamind.api import...
github_jupyter
# Control Flow ### Python if else ``` def multiply(a, b): """Function to multiply""" print(a * b) print(multiply.__doc__) multiply(5,2) def func(): """Function to check i is greater or smaller""" i=10 if i>5: print("i is greater than 5") else: print("i is less than 15") print(f...
github_jupyter
``` # Code for artery tracking #simplified from 1-1 %load_ext autoreload %autoreload 2 import os os.environ["CUDA_VISIBLE_DEVICES"]="0" import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") import json import cv2 import os import matplotlib.pyplot as plt import copy import numpy as np im...
github_jupyter
# Day and Night Image Classifier --- The day/night image dataset consists of 200 RGB color images in two categories: day and night. There are equal numbers of each example: 100 day images and 100 night images. We'd like to build a classifier that can accurately label these images as day or night, and that relies on f...
github_jupyter
<a href="https://colab.research.google.com/github/Abhishekauti21/dsmp-pre-work/blob/master/practice_project.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` class test: def __init__(self,a): self.a=a def display(self): print(...
github_jupyter
# Detecting COVID-19 with Chest X Ray using PyTorch Image classification of Chest X Rays in one of three classes: Normal, Viral Pneumonia, COVID-19 Dataset from [COVID-19 Radiography Dataset](https://www.kaggle.com/tawsifurrahman/covid19-radiography-database) on Kaggle # Importing Libraries ``` from google.colab im...
github_jupyter
# Plotting Target Pixel Files with Lightkurve ## Learning Goals By the end of this tutorial, you will: - Learn how to download and plot target pixel files from the data archive using [Lightkurve](https://docs.lightkurve.org). - Be able to plot the target pixel file background. - Be able to extract and plot flux from...
github_jupyter
##### Copyright 2018 The TensorFlow Authors. [Licensed under the Apache License, Version 2.0](#scrollTo=ByZjmtFgB_Y5). ``` // #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" } // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file ...
github_jupyter
``` import numpy as np import pandas as pd import scipy as sp from scipy import sparse import nltk from nltk.corpus import stopwords from nltk.stem.porter import PorterStemmer import string import re import glob from sklearn.linear_model import LogisticRegression from sklearn.feature_extraction.text import CountVec...
github_jupyter
## LDA The graphical model representation of LDA is given blow: <img src="figures/LDA.png"> The basic idea of LDA is that documents are represented as random mixtures over latent topics, where each topic is characterized by a distribution over words. LDA assumes the following generative process for each document $\m...
github_jupyter
# Example 1: Sandstone Model ``` # Importing import theano.tensor as T import theano import sys, os sys.path.append("../GeMpy") sys.path.append("../") # Importing GeMpy modules import gempy as GeMpy # Reloading (only for development purposes) import importlib importlib.reload(GeMpy) # Usuful packages import numpy as...
github_jupyter
<a href="https://colab.research.google.com/github/100rab-S/TensorFlow-Advanced-Techniques/blob/main/C1W3_L3_CustomLayerWithActivation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Ungraded Lab: Activation in Custom Layers In this lab, we extend...
github_jupyter
# Using Google Cloud Functions to support event-based triggering of Cloud AI Platform Pipelines > This post shows how you can run a Cloud AI Platform Pipeline from a Google Cloud Function, providing a way for Pipeline runs to be triggered by events. - toc: true - badges: true - comments: true - categories: [ml, pipel...
github_jupyter
# Herramientas Estadisticas # Contenido: 1.Estadistica: - Valor medio. - Mediana. - Desviacion estandar. 2.Histogramas: - Histrogramas con python. - Histogramas con numpy. - Como normalizar un histograma. 3.Distribuciones: - Como obtener una distribucion a partir...
github_jupyter
# 01 - Sentence Classification Model Building # Parse & clearn labeled training data ``` import xml.etree.ElementTree as ET tree = ET.parse('../data/Restaurants_Train.xml') root = tree.getroot() root # Use this dataframe for multilabel classification # Must use scikitlearn's multilabel binarizer labeled_reviews = []...
github_jupyter
# Network inference of categorical variables: non-sequential data ``` import sys import numpy as np from scipy import linalg from sklearn.preprocessing import OneHotEncoder import matplotlib.pyplot as plt %matplotlib inline import inference import fem # setting parameter: np.random.seed(1) n = 20 # number of positi...
github_jupyter
1. You are provided the titanic dataset. Load the dataset and perform splitting into training and test sets with 70:30 ratio randomly using test train split. 2. Use the Logistic regression created from scratch (from the prev question) in this question as well. 3. Data cleaning plays a major role in this question. Repo...
github_jupyter
起手式,導入 numpy, matplotlib ``` from PIL import Image import numpy as np %matplotlib inline import matplotlib import matplotlib.pyplot as plt matplotlib.style.use('bmh') matplotlib.rcParams['figure.figsize']=(8,5) ``` 使用之前下載的 mnist 資料,載入訓練資料 `train_set` 和測試資料 `test_set` ``` import gzip import pickle with gzip.open('.....
github_jupyter
# Python For Bioinformatics Introduction to Python for Bioinformatics - available at https://github.com/kipkurui/Python4Bioinformatics. <small><small><i> ## Attribution These tutorials are an adaptation of the Introduction to Python for Maths by [Andreas Ernst](http://users.monash.edu.au/~andreas), available from ht...
github_jupyter
Скородумов Александр БВТ1904 Лабораторная работа №2 Методы поиска №1 ``` #Импорты from IPython.display import HTML, display from tabulate import tabulate import random import time #Рандомная генерация def random_matrix(m = 50, n = 50, min_limit = -250, max_limit = 1016): return [[random.randint(min_limit, max_l...
github_jupyter
``` import numpy as np import tensorflow_datasets as tfds import tensorflow as tf tf.config.run_functions_eagerly(False) #tfds.disable_progress_bar() tf.version.VERSION import pandas as pd dataset = pd.read_csv("/content/drive/MyDrive/sentiment-dataset/airline_sentiment_analysis.csv") print (dataset[:10]) print (data...
github_jupyter
``` import tensorflow as tf from tensorflow.python.keras.utils import HDF5Matrix from tensorflow.python.keras.models import Model from tensorflow.python.keras.layers import (Input, Lambda, Conv2D, MaxPooling2D, Flatten, Dense, Dropout, Lambda, Activation, BatchNormalization,...
github_jupyter
``` import numpy as np class PCA: def __init__(self, n_components): """ 初始化PCA """ assert n_components>=1, "n_components 必须大于1" self.n_components=n_components self.components_=None def fit(self, X, eta=0.01,n_iters=1e4): """ 获得数据集X的n_...
github_jupyter
# Implementing a Neural Network In this exercise we will develop a neural network with fully-connected layers to perform classification, and test it out on the CIFAR-10 dataset. ``` # A bit of setup import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.neural_net import TwoLayerNet %matplotlib ...
github_jupyter
``` import pandas as pd import numpy as np # import pymssql # from fuzzywuzzy import fuzz import json import tweepy from collections import defaultdict from datetime import datetime import re # import pyodbc from wordcloud import WordCloud import seaborn as sns import matplotlib.pyplot as plt from wordcloud import Word...
github_jupyter
### Project: Create a neural network class --- Based on previous code examples, develop a neural network class that is able to classify any dataset provided. The class should create objects based on the desired network architecture: 1. Number of inputs 2. Number of hidden layers 3. Number of neurons per layer 4. Num...
github_jupyter
# Titanic 4 > ### `Pclass, Sex, Age` ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns plt.style.use('seaborn') sns.set(font_scale=2.5) import missingno as msno import warnings warnings.filterwarnings('ignore') %matplotlib inline df_train=pd.read_csv('C:/Users/ehfus/D...
github_jupyter
# Section 1.2: Dimension reduction and principal component analysis (PCA) One of the iron laws of data science is know as the "curse of dimensionality": as the number of considered features (dimensions) of a feature space increases, the number of data configurations can grow exponentially and thus the number observati...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/geemap/tree/master/examples/notebooks/geemap_and_ipyleaflet.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank" href=...
github_jupyter
# Gender and Age Detection ``` import pandas as pd import numpy as np import os import matplotlib.pyplot as plt import cv2 from tensorflow.keras.models import Sequential, load_model, Model from tensorflow.keras.layers import Conv2D, MaxPool2D, Dense, Dropout, BatchNormalization, Flatten, Input from sklearn.model_selec...
github_jupyter
# An Introduction to SageMaker LDA ***Finding topics in synthetic document data using Spectral LDA algorithms.*** --- 1. [Introduction](#Introduction) 1. [Setup](#Setup) 1. [Training](#Training) 1. [Inference](#Inference) 1. [Epilogue](#Epilogue) # Introduction *** Amazon SageMaker LDA is an unsupervised learning ...
github_jupyter