text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` import pandas as pd import matplotlib.pyplot as plt import xlrd import os ``` 打开excel文件并获取sheet数量及各sheet的名称 ``` path = 'C:\\Users\\Z0050908\\Documents\\Jupyter_scipt\\group5\\group5\\Result analysis\\Original.XLS' # df = pd.read_excel(path) data = xlrd.open_workbook(path) count = len(data.sheets()) sheet_name = [...
github_jupyter
# Fine-Tuning a BERT Model and Create a Text Classifier We have already performed the Feature Engineering to create BERT embeddings from the `reviews_body` text using the pre-trained BERT model, and split the dataset into train, validation and test files. To optimize for Tensorflow training, we saved the files in TFRe...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import numpy as np %matplotlib inline df = pd.read_csv("/data/iris.csv") df.head() features = ["SepalLengthCm", "PetalLengthCm"] df.Species.value_counts() fig, ax = plt.subplots() colors = ["red", "green", "blue"] for i, v in enumerate(df.Species.unique()): ...
github_jupyter
##### Copyright 2018 Google LLC. Licensed under the Apache License, Version 2.0 (the "License"); 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...
github_jupyter
### Preprocessing ``` # import relevant statistical packages import numpy as np import pandas as pd # import relevant data visualisation packages import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline # load Default dataset url = "/Users/arpanganguli/Documents/Professional/Finance/ISLR/Datasets/Defau...
github_jupyter
``` import pandas as pd import numpy as np import scipy.stats import matplotlib.pyplot as plt import tensorflow as tf import statistics as stats from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error from sklearn.preprocessing import MinMaxScaler from sklearn.preprocessing ...
github_jupyter
# Laboratorio 3.1 *Elaborado por Oscar Franco-Bedoya* *`Proyecto Mision TIC 2021* ## Objetivo Aplicar el concepto de modulos mediante la impementación de programas que utilizan librerias de Python como math y random. ## La calculadora de Trigo ### Contexto El profesor de matemáticas del colegio de la esquina ha de...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import math import cv2 from skimage import io, color, exposure, feature, filters, util, measure from skimage import img_as_ubyte from skimage import img_as_float from skimage.filters import threshold_otsu from skimage.draw import ellipse_perimeter from skimage.dr...
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
# PYNQ tutorial: DMA to streamed interfaces Overlay consists of two DMAs and an AXI Stream FIFO (input and output AXI stream interfaces). The FIFO represents an accelerator. A single DMA could be used with a read and write channel enabled, but for demonstration purposes, two different DMAs will be used. * The first ...
github_jupyter
# Machine Learning Engineer Nanodegree ## Reinforcement Learning ## Project: Train a Smartcab to Drive Welcome to the fourth project of the Machine Learning Engineer Nanodegree! In this notebook, template code has already been provided for you to aid in your analysis of the *Smartcab* and your implemented learning alg...
github_jupyter
# Using Automated Machine Learning There are many kinds of machine learning algorithm that you can use to train a model, and sometimes it's not easy to determine the most effective algorithm for your particular data and prediction requirements. Additionally, you can significantly affect the predictive performance of a...
github_jupyter
# Tenor functions with Pytorch ### Torch up your tensor game The following 5 functions might empower you to navigate through your Deep Learning endeavours with Pytorch - torch.diag() - torch.inverse() - torch.randn() - torch.zeros_like() - torch.arange() ``` # Import torch and other required modules import torch ``...
github_jupyter
# Specific examples of transitions data # 0. Import dependencies and inputs ``` %run ../../notebook_preamble_Transitions.ipy # Location to store transitions data outputs_folder = f'{useful_paths.data_dir}processed/transitions/specific_examples/' # File name to use for the specific examples file_name = 'Data_example'...
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 matplotlib.pyplot as plt import seaborn as sns import pandas as pd import datetime from datetime import datetime from sklearn.metrics import mean_squared_error %matplotlib inline plt.style.use('fivethirtyeight') #Used for replicating graph styles from fivethirtyeight.com from k...
github_jupyter
<!--NOTEBOOK_HEADER--> *This notebook contains material from [cbe61622](https://jckantor.github.io/cbe61622); content is available [on Github](https://github.com/jckantor/cbe61622.git).* <!--NAVIGATION--> < [A.2 Downloading Python source files from github](https://jckantor.github.io/cbe61622/A.02-Downloading_Python_so...
github_jupyter
# Tutorial 05: Creating Custom Networks This tutorial walks you through the process of generating custom networks. Networks define the network geometry of a task, as well as the constituents of the network, e.g. vehicles, traffic lights, etc... Various networks are available in Flow, depicting a diverse set of open an...
github_jupyter
TSG033 - Show BDC SQL status ============================ Steps ----- ### Common functions Define helper functions used in this notebook. ``` # Define `run` function for transient fault handling, hyperlinked suggestions, and scrolling updates on Windows import sys import os import re import json import platform imp...
github_jupyter
# Predicting Marketing Efforts: SEO Advertising, Brand Advertising, and Retailer Support Let's look at predicting the average Brand Advertising Efforts and Search Engine Optimization Efforts This helps us make more accurate decisions in BSG and identify if we'll hit the shareholder expectations for the period. ``` #...
github_jupyter
### Een parser-generator voor de wordgrammar In de ETCBC-data wordt een morphologische analyse-annotatie gebruikt, die per project kan worden gedefinieerd in een `word_grammar`-definitiebestand. Per project moet er eerst een annotatieparser worden gegenereerd aan de hand van het `word-grammar`-bestand. Dat gebeurt in ...
github_jupyter
最初に必要なライブラリを読み込みます。 ``` from sympy import * from sympy.physics.quantum import * from sympy.physics.quantum.qubit import Qubit, QubitBra, measure_all, measure_all_oneshot from sympy.physics.quantum.gate import H,X,Y,Z,S,T,CPHASE,CNOT,SWAP,UGate,CGateS,gate_simp from sympy.physics.quantum.gate import IdentityGate as _I ...
github_jupyter
``` import numpy as np import torch import math import matplotlib import matplotlib.pyplot as plt import pandas as pd import seaborn as sns import GPyOpt import GPy import os import matplotlib as mpl import matplotlib.tri as tri import ternary import pickle import datetime from collections import Counter import matplot...
github_jupyter
## Introduction to Pandas Pandas is a newer package built on top of NumPy, and provides an efficient implementation of a DataFrame . DataFrame s are essentially multidimen‐ sional arrays with attached row and column labels, and often with heterogeneous types and/or missing data. As well as offering a convenient storag...
github_jupyter
# Project 2: Continuous Control ### Test 2 - PPO model <sub>Uirá Caiado. October 15, 2018<sub> #### Abstract _In this notebook, I will use the Unity ML-Agents environment to train a PPO model for the second project of the [Deep Reinforcement Learning Nanodegree](https://www.udacity.com/course/deep-reinforcement-lear...
github_jupyter
# The Laplace Transform *This Jupyter notebook is part of a [collection of notebooks](../index.ipynb) in the bachelors module Signals and Systems, Communications Engineering, Universität Rostock. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sascha.Spors@uni-rostock.de).* ## Inverse ...
github_jupyter
``` %matplotlib inline %config InlineBackend.figure_formats = {'png', 'retina'} data_key = pd.read_csv('key.csv') data_key = data_key[data_key['station_nbr'] != 5] data_weather = pd.read_csv('weather.csv') data_weather = data_weather[data_weather['station_nbr'] != 5] ## Station 5번 제거한 나머지 data_train = pd.read_csv('tra...
github_jupyter
# ElasticSearch DSL Librería de alto nivel que ayuda a escribir y ejecutar consultas en Elastic. Proporciona una API más idiomática y pythonica para manipular y componer consultas. Proporciona una capa para trabajar con los documentos, definiendo el mapping, rescatar, actualizar, guardar documentos, usando orientació...
github_jupyter
## ResFPN Classifier Tutorial - Flower Photos by *Ming Ming Zhang* ``` import tensorflow as tf print('TF Version:', tf.__version__) #print('GPUs:', len(tf.config.list_physical_devices('GPU'))) import numpy as np import matplotlib.pyplot as plt import os, sys # python files directory PY_DIR = #'directory/to/python/fi...
github_jupyter
# **BentoML Example: Image Segmentation with PaddleHub** **BentoML makes moving trained ML models to production easy:** * Package models trained with any ML framework and reproduce them for model serving in production * **Deploy anywhere** for online API serving or offline batch serving * High-Performance API mode...
github_jupyter
# Hyperparameter tuning ## Spark <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f3/Apache_Spark_logo.svg/1280px-Apache_Spark_logo.svg.png" width="400"> # Load data and feature engineering ``` import numpy as np import datetime import findspark findspark.init() from pyspark.sql import SparkSession...
github_jupyter
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/manual_setup.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 **Manual Python Setup** * Instructor: [Jeff H...
github_jupyter
``` from os import listdir from keras.models import model_from_json from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences from nltk.translate.bleu_score import sentence_bleu from tqdm import tqdm import numpy as np import h5py as h5py from compiler.classes.Compiler import...
github_jupyter
<a href="https://colab.research.google.com/github/pachterlab/CBP_2021/blob/main/notebooks/VMHNeurons/kimetal_smartseq_predictions.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import requests import os from tqdm import tnrange, tqdm_notebook...
github_jupyter
# Ax Service API with RayTune on PyTorch CNN Ax integrates easily with different scheduling frameworks and distributed training frameworks. In this example, Ax-driven optimization is executed in a distributed fashion using [RayTune](https://ray.readthedocs.io/en/latest/tune.html). RayTune is a scalable framework for...
github_jupyter
``` #code is used from these 3 repositories, have a look at them on GitHub or access the files from colab !git clone https://github.com/PeterWang512/FALdetector !git clone https://github.com/NVIDIA/flownet2-pytorch.git !git clone https://github.com/Kwanss/PCLNet #import necessary modules and append paths import rando...
github_jupyter
## Data Centric ML Development using Snowflake and Amazon SageMaker This notebook guides you through a Data Centric machine learning (ML) development process using Snowflake and Amazon SageMaker. We demonstrate the use case through a credit-risk analysis use case. **What you will learn:** * How to use the Snowflake ...
github_jupyter
**[Pandas Home Page](https://www.kaggle.com/learn/pandas)** --- # Introduction Run the following cell to load your data and some utility functions. ``` from learntools.core import binder; binder.bind(globals()) from learntools.pandas.renaming_and_combining import * print("Setup complete.") import pandas as pd revi...
github_jupyter
# Shifting Previous Week Stats to Predict Current Week Performance Author: Aidan O'Connor Date: 15 June 2021 In this notebook, I'll take previous week stats and shift them to current week predictions. ``` # Import pandas for data manipulation and sqlite3 for stored data access import pandas as pd import sqlite3...
github_jupyter
# Obsessed with Boba? Analyzing Bubble Tea Shops in NYC Using the Yelp Fusion API Exploratory Data Analysis ``` # # imports for Google Colab Sessions # !apt install gdal-bin python-gdal python3-gdal # # Install rtree - Geopandas requirment # !apt install python3-rtree # # Install Geopandas # !pip install git+git://g...
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. **Notation**: - Superscript $[l]$ denotes an object of the $l...
github_jupyter
<a href="https://colab.research.google.com/github/GiselaCS/Mujeres_Digitales/blob/main/KNN_(Ejemplo_1).ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Cargamos todas las librerías necesarias. Utilizaremos la clase KNeighborsClassifier, para poder us...
github_jupyter
# 1: Palindrome 1 ``` palindrome_answer = "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba" def basic_palindrome(): letter = 'a' output_string = "" # chr() converts a numeric value to a character and ord() converts a character to a numeric value # This allows us to arithmetically change the va...
github_jupyter
# Content: 1. [Simple example](#1.-Simple-example) 2. [Parametric equations](#2.-Parametric-equations) 3. [Polishing the plot](#3.-Polishing-the-plot) 4. [Contour plot](#4.-Contour-plot) 5. [Beginner-level animation](#5.-Beginner-level-animation) 6. [Intermediate-level animation](#6.-Intermediate-level-animation) ## 1...
github_jupyter
# Least Squares Regression for Impedance Analysis ![](spectrumTest.png) ## Introduction This is a tutorial for how to set up the functions and calls for curve fitting an experimental impedance spectrum with Python using a least squares regression. Four different models are used as examples for how to set up the curv...
github_jupyter
``` import os from tensorflow.keras import layers from tensorflow.keras import Model !wget --no-check-certificate \ https://storage.googleapis.com/mledu-datasets/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 \ -O /tmp/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 from tensorflow.keras....
github_jupyter
``` %matplotlib inline import ipywidgets as widgets from ipywidgets import interact import numpy as np import matplotlib.pyplot as pl from scipy.spatial.distance import cdist from numpy.linalg import inv import george ``` # Gaussian process regression ## Lecture 1 ### Suzanne Aigrain, University of Oxford #### LSS...
github_jupyter
# `stedsans` This is a notebook showing the current and most prominent capabilities of `stedsans`. It is heavily recommended to run the notebook by using Google Colab: <br> <br> [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MalteHB/stedsans/blob/...
github_jupyter
``` import sys sys.path.append('src/') import numpy as np import torch, torch.nn from library_function import library_1D from neural_net import LinNetwork from DeepMod import * import matplotlib.pyplot as plt plt.style.use('seaborn-notebook') import torch.nn as nn from torch.autograd import grad from scipy.io import lo...
github_jupyter
## 1. Import basic libraries ``` import pandas as pd import pandas_profiling import numpy as np import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns import matplotlib.ticker as mtick ``` ## 2. Read final.csv ``` data = pd.read_csv('Data/final.csv') ``` ## 3. And now let's carefully analyse the d...
github_jupyter
# Extreme Gradient Boosting Regressor ### Required Packages ``` !pip install xgboost import warnings import numpy as np import pandas as pd import seaborn as se import xgboost as xgb import matplotlib.pyplot as plt from xgboost import XGBRegressor from sklearn.model_selection import train_test_split from s...
github_jupyter
# Characterization of Systems in the Time Domain *This Jupyter notebook is part of a [collection of notebooks](../index.ipynb) in the bachelors module Signals and Systems, Communications Engineering, Universität Rostock. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sascha.Spors@uni-r...
github_jupyter
``` # LSTM for international airline passengers problem with window regression framing import numpy import numpy as np import keras import matplotlib.pyplot as plt from pandas import read_csv import math from keras.models import Sequential from keras.layers import Dense,Dropout from keras.layers import LSTM from sklear...
github_jupyter
``` import pandas as pd import zipfile import numpy as np import sys import numpy as np import matplotlib.pyplot as plt from IPython.display import display directory_lic='C:\\repos\\public-procurement\\data\\licitaciones\\' directory_oc='C:\\repos\\public-procurement\\data\\ordenes\\' year_range=np.arange(2010,2021,1...
github_jupyter
# Simple Model of a Car on a Bumpy Road This notebook allows you to compute and visualize the car model presented in Example 2.4.2 the book. The road is described as: $$y(t) = Ysin\omega_b t$$ And $\omega_b$ is a function of the car's speed. ``` import numpy as np def x_h(t, wn, zeta, x0, xd0): """Returns the ...
github_jupyter
``` import pandas as pd import numpy as np from source.make_train_test import make_teams_target pd.set_option("max_columns", 300) def _add_stage(total): total['stage'] = '68' total.loc[(total.DayNum == 136) | (total.DayNum == 136), 'stage'] = '64' total.loc[(total.DayNum == 138) | (total.DayNum == 139), '...
github_jupyter
``` def cosamp(Phi, u, s, tol=1e-10, max_iter=1000): """ @Brief: "CoSaMP: Iterative signal recovery from incomplete and inaccurate samples" by Deanna Needell & Joel Tropp @Input: Phi - Sampling matrix u - Noisy sample vector s - Sparsity vector @Return: A s...
github_jupyter
# SLU10 - Metrics for regression: Learning Notebook In this notebook, you will learn about: - Loss functions vs. Evaluation Metrics - Mean Squared Error (MSE) - Root Mean Squared Error (RMSE) - Mean Absolute Error (MAE) - Coefficient of Determination (R²) - Adjusted R² - Scikitlearn metrics...
github_jupyter
# Model Understanding Simply examining a model's performance metrics is not enough to select a model and promote it for use in a production setting. While developing an ML algorithm, it is important to understand how the model behaves on the data, to examine the key factors influencing its predictions and to consider ...
github_jupyter
In this blog we will discuss about the inference for MLR. How to choose significant predictor by Hypothesis Test and Confidence Interval, as well as doing interpretations for the slope. ![jpeg](../galleries/coursera-statistics/8w17.jpg) *Screenshot taken from [Coursera](https://class.coursera.org/statistics-003/lect...
github_jupyter
# Think Bayes: Chapter 7 This notebook presents code and exercises from Think Bayes, second edition. Copyright 2016 Allen B. Downey MIT License: https://opensource.org/licenses/MIT ``` from __future__ import print_function, division % matplotlib inline import warnings warnings.filterwarnings('ignore') import math...
github_jupyter
# Determining rigid body transformation using the SVD algorithm Marcos Duarte Ideally, three non-colinear markers placed on a moving rigid body is everything we need to describe its movement (translation and rotation) in relation to a fixed coordinate system. However, in pratical situations of human motion analysis, ...
github_jupyter
``` !pip install keras from keras.models import Model from keras.optimizers import SGD,Adam,RMSprop # from keras.layers import Dense, Input, LSTM, Embedding,Dropout,Bidirectional,Flatten from keras.layers import * import os # from __future__ import print_function from keras import backend as K from keras.engine.topolo...
github_jupyter
``` from PreFRBLE.likelihood import * from PreFRBLE.plot import * ``` ### Identify intervening galaxies Here we attempto to identify LoS with intervening galaxies. For this purpose, we compare the likelihood of temporal broadening $L(\tau)$ for scenarios with and without intervening galaxies, as well as consider a sc...
github_jupyter
``` from __future__ import absolute_import from __future__ import division from __future__ import print_function %pylab %matplotlib inline import os import math import time import tensorflow as tf from datasets import dataset_utils,cifar10 from tensorflow.contrib import slim ``` # lrn적용한 버젼! ``` dropout_keep_prob=0.8...
github_jupyter
# This is the Saildrone and MUR global 1 km sea surface temperature collocation code. ``` import os import numpy as np import matplotlib.pyplot as plt import datetime as dt import xarray as xr def get_sat_filename(date): dir_sat='F:/data/sst/jpl_mur/v4.1/' syr, smon, sdym, sjdy = str(date.dt.year.data), str(d...
github_jupyter
``` import numpy as np import cv2 import matplotlib.pyplot as plt import glob from keras.layers import Input, concatenate, Conv2D, MaxPooling2D, UpSampling2D, Dropout, Cropping2D from keras.optimizers import Adam from keras.callbacks import ModelCheckpoint, LearningRateScheduler from keras import backend as K from ker...
github_jupyter
Introdução ao NumPy =========== O tipo *ndarray* -------------------- O tipo *ndarray*, ou apenas *array* é um arranjo de itens homogêneos de dimensionalidade N, indexados por uma tupla de N inteiros. Existem 3 informações essenciais associadas ao *ndarray*: o tipo dos dados, suas dimensões e seus dados em si. A pr...
github_jupyter
## Introduction to AWS ParallelCluster For an overview of this workshop, please read [README.md](README.md) This notebook shows the main steps to create a ParallelCluster. Steps to prepare (pre and post cluster creation) for the ParallelCluster are coded in pcluster-athena.py. #### Before: - Create ssh key - Creat...
github_jupyter
<img src="../../../../../images/qiskit_header.png" alt="Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook" align="middle"> # _*Qiskit Finance: Pricing Asian Barrier Spreads*_ The latest version of this notebook is available on https://github.com/Qiskit/qiskit-t...
github_jupyter
# Deep Markov Model ## Introduction We're going to build a deep probabilistic model for sequential data: the deep markov model. The particular dataset we want to model is composed of snippets of polyphonic music. Each time slice in a sequence spans a quarter note and is represented by an 88-dimensional binary vector...
github_jupyter
This notebook demonstrates [vaquero](https://github.com/jbn/vaquero), as both a library and data cleaning pattern. ``` from vaquero import Vaquero, callables_from ``` # Task Say you think you have pairs of numbers serialized as comma separated values in a file. You want to extract the pair from each line, then sum o...
github_jupyter
``` %matplotlib inline ``` **1**. (25 points) We have a surgeon who wants to find rich, obese patients for bariatric surgery. The surgeon purchases 3rd party databases that include the following: - patients - includes height and weight for 100 patients - finances - income of patients - orders - patients who have bou...
github_jupyter
# Customer Segmentation in Python This notebook explains how to perform Association Analysis from customer purchase history data. We are using [pandas](https://pandas.pydata.org) (for data manipulation) and [mlxtend](https://github.com/rasbt/mlxtend) (for apriori and association rules algorithnms). The data we're usin...
github_jupyter
# Algo - Aparté sur le voyageur de commerce Le voyageur de commerce ou Travelling Salesman Problem en anglais est le problème NP-complet emblématique : il n'existe pas d'algorithme capable de trouver la solution optimale en temps polynômial. La seule option est de parcourir toutes les configurations pour trouver la me...
github_jupyter
``` import os import json tmp = dict() """ Daily Met Livneh 2013 """ tmp['dailymet_livneh2013'] = dict() tmp['dailymet_livneh2013']['spatial_resolution'] = '1/16-degree' tmp['dailymet_livneh2013']['web_protocol'] = 'ftp' tmp['dailymet_livneh2013']['domain'] = 'livnehpublicstorage.colorado.edu' tmp['dailymet_livneh2013'...
github_jupyter
# Метод ADMM (alternating direction methods of multipliers) ## На прошлом семинаре - Субградиентный метод: базовый метод решения негладких задач - Проксимальный метод и его свойства: альтернатива градиентному спуску - Проксимальный градиентный метод: заглядывание в чёрный ящик - Ускорение проксимального градиентного ...
github_jupyter
# Summary Statistics - Exercises In these exercises we'll use a real life medical dataset to learn how to obtain basic statistics from the data. This dataset comes from [Gluegrant](https://www.gluegrant.org/), an American project that aims to find a which genes are more important for the recovery of severely injured pa...
github_jupyter
``` # -*- coding: utf-8 -*- import pymongo import pymysql from lxml import etree import re import pandas as pd import numpy as np import warnings warnings.filterwarnings("ignore") # -*- coding: utf-8 -*- import pymongo import urllib def get_mongo_db_client(): username_str = 'breadt' password_str = 'Breadt@201...
github_jupyter
<a href="https://colab.research.google.com/github/mikislin/summer20-Intro-python/blob/master/07_Matplotlib_Solutions.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> **(a)** Write a Python program to draw a scatter plot using random distributions to ...
github_jupyter
<b> One-Layer Atmosphere Model </b><br> Reference: Walter A. Robinson, Modeling Dynamic Climate Systems ``` import numpy as np import matplotlib.pyplot as plt plt.style.use("seaborn-dark") # Step size dt = 0.01 # Set up a 10 years simulation tmin = 0 tmax = 10 t = np.arange(tmin, tmax + dt, dt) n = len(t) # Seconds...
github_jupyter
``` import keras from keras.models import Sequential, Model, load_model from keras.layers import Dense, Dropout, Activation, Flatten, Input, Lambda from keras.layers import Conv2D, MaxPooling2D, AveragePooling2D, Conv1D, MaxPooling1D, LSTM, ConvLSTM2D, GRU, CuDNNLSTM, CuDNNGRU, BatchNormalization, LocallyConnected2D, ...
github_jupyter
# Math Operations ``` from __future__ import print_function import torch import numpy as np from datetime import date date.today() author = "kyubyong. https://github.com/Kyubyong/pytorch_exercises" torch.__version__ np.__version__ ``` NOTE on notation _x, _y, _z, ...: NumPy 0-d or 1-d arrays<br/> _X, _Y, _Z, ...: Nu...
github_jupyter
``` import os import tensorflow as tf import pandas as pd from sklearn.utils import shuffle import matplotlib.pyplot as plt import matplotlib.patches as patches from PIL import Image import shutil import keras import keras.backend as K from keras.models import Model from keras import backend as K from keras.utils imp...
github_jupyter
<a href="https://colab.research.google.com/github/AlexTeboul/msds/blob/main/csc594-topics-in-artificial-intelligence/CSC594_Emotional_Contagion_Content_Theory_Implementation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #Alex Teboul #CSC 594 - Em...
github_jupyter
# Introduction In this tutorial, we will train a regression model with Foreshadow using the [House Pricing](https://www.kaggle.com/c/house-prices-advanced-regression-techniques) dataset from Kaggle. # Getting Started To get started with foreshadow, install the package using `pip install foreshadow`. This will also in...
github_jupyter
``` import re import requests from html.parser import HTMLParser from time import sleep from tqdm import tqdm #手工输入会议以及链接 # """GECCO, SSBSE, QRS还没找到""" journals = [] confs = [] for line in open("conf_list.csv"): line = line.replace("http://","https://").replace("/index.html","/") data = line.split("\t") i...
github_jupyter
# Skip-gram word2vec In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language processing. This will come in handy when dealing with things like translations. ## Re...
github_jupyter
# 日本語手紙文字OCRサンプル ## OpenVINOのインストールディレクトリからオリジナルのサンプルコード関連ファイルをコピー ``` !cp $INTEL_OPENVINO_DIR/inference_engine/demos/python_demos/handwritten_japanese_recognition_demo/requirements.txt . !cp $INTEL_OPENVINO_DIR/inference_engine/demos/python_demos/handwritten_japanese_recognition_demo/models.lst . !cp -r $INTEL_OPENV...
github_jupyter
# Prepare Glove vector ``` import numpy as np import codecs import pickle import operator def loadGloveModel(gloveFile): print "Loading Glove Model" f = codecs.open(gloveFile,'r') model = {} for line in f: splitLine = line.split() word = splitLine[0] embedding = [float(val)...
github_jupyter
# Categorical Features CV Encoding ### Explanation: https://medium.com/@pouryaayria/k-fold-target-encoding-dfe9a594874b ``` from google.colab import drive drive.mount('/content/gdrive') !pip install category_encoders # General imports import numpy as np import pandas as pd import os, sys, gc, warnings, random, dateti...
github_jupyter
# Simple 10-class classification ``` import keras from keras.models import Sequential from keras.layers import Dense, Activation import numpy as np import matplotlib.pyplot as plt import warnings # Suppress warkings (gets rid of some type-conversion warnings) warnings.filterwarnings("ignore") %matplotlib inline ``` ...
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
# MODEL ANALYSIS [TEST DATA] #### Dependecies ``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from sklearn.metrics import brier_score_loss LEN = range(70, 260, 10) def decodePhed(x): return 10**(-x/10.0) ``` #### Load csv files ``` test_regul...
github_jupyter
# Imports ``` #!pip install plotly from os import listdir from os.path import isfile, join import pandas as pd import cbsodata from datetime import datetime import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline import altair as alt from sklearn import preprocessing import plotly.express as px from ...
github_jupyter
``` %matplotlib inline import pandas as pd import numpy as np import os.path import matplotlib.pyplot as plt import seaborn as sns import math from scipy.stats import poisson def ColumnNames(): return ['col1', 'col2', 'col3', 'average'] def PreProcess(filepath, skiprows, usecols): """ This function reads ...
github_jupyter
# Using Threshold - Based Source Detection and Confusion Matrix This notebook provides an example of how to run the astropy - based source detection on a fits file. This also demonstrates how to generate a confusion matrix based on the results of the source detection. ``` import astropy from astropy.io import fits fro...
github_jupyter
# LiH Molecule: Constructing Potential Energy Surfaces Using VQE ## Step 1: Classical calculations ``` import numpy as np import matplotlib.pyplot as plt from utility import * import tequila as tq threshold = 1e-6 #Cutoff for UCC MP2 amplitudes and QCC ranking gradients basis = 'sto-3g' ``` #### Classical Electroni...
github_jupyter
# Face Recognition for the Happy House Welcome to the first assignment of week 4! Here you will build a face recognition system. Many of the ideas presented here are from [FaceNet](https://arxiv.org/pdf/1503.03832.pdf). In lecture, we also talked about [DeepFace](https://research.fb.com/wp-content/uploads/2016/11/deep...
github_jupyter
# CappingTransformer This notebook shows the functionality in the CappingTransformer class. This transformer caps numeric columns at either a maximum value or minimum value or both. <br> ``` import pandas as pd import numpy as np from sklearn.datasets import fetch_california_housing import tubular from tubular.capping...
github_jupyter