text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
## Example 1: `Hello world`
```
# Print the character string `Hello world!`
print('Hello world!')
```
## Example 2: Make a plot of the US unemployment rate
Download unemployment rate data from FRED (https://fred.stlouisfed.org/series/UNRATE/) and make a well-labeled plot.
```
# Import the pandas library as pd
impor... | github_jupyter |
```
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import datetime
import warnings
warnings.filterwarnings('ignore')
coronavirus = pd.read_csv('patient2.csv')
coronavirus.head()
coronavirus.shape
#coronavirus['death'] = coronavirus['death'].astype('Int64')
#coronavirus['ag... | github_jupyter |
## Libraries
```
#Import All Dependencies
# import cv2, os, bz2, json, csv, difflib, requests, socket, whois, urllib.request, urllib.parse, urllib.error, re, OpenSSL, ssl
import numpy as np
from datetime import datetime
from urllib.parse import urlparse
from urllib.request import Request, urlopen
# from selenium impor... | github_jupyter |
___
<a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>
___
# Python Crash Course Exercises
This is an optional exercise to test your understanding of Python Basics. If you find this extremely challenging, then you probably are not ready for the rest of this course yet and don't have eno... | github_jupyter |
##内容检索
1. 简单绘图 --- plot函数、title函数、subplot函数
2. 绘制百度的全年股票价格 --- figure函数、add_subplot函数、一些设置x轴刻度和标签的函数
3. 绘制直方图 --- hist函数
4. 对数坐标图 --- semilogx函数等
5. 散点图 --- scatter函数
6. 着色 --- fill_between函数
7. 图例和注释 --- legend函数、annotate函数
```
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
```
##1. 简单绘图
matpl... | github_jupyter |
```
# Load the Drive helper and mount
from google.colab import drive
# This will prompt for authorization.
drive.mount('/content/drive')
!ls "/content/drive/My Drive/SkinDataset"
!cp "/content/drive/My Drive/SkinDataset/train_skin.zip" "train_skin.zip"
!cp "test.zip" "/content/drive/My Drive/SkinDataset/test.zip"
!unz... | github_jupyter |
```
from utils import GensimModels
from nltk.stem import WordNetLemmatizer
import Config
import numpy as np
import random
import csv
train = Config.path_culture
feat_dim = 10
gensimLoader = GensimModels.GensimModels()
model_loaded = gensimLoader.load_word2vec(path=Config.path_embeddings_ingredients)
cult2id = {}
id2... | github_jupyter |
# Chapter 5 - Commmunity Detection
In this notebook, we explore several algorithms to find communities in graphs.
In some cells, we use the ABCD benchmark to generate synthetic graphs with communities.
ABCD is written in Julia.
### Installing Julia and ABCD
We use the command line interface option to run ABCD belo... | github_jupyter |
# Values and Variables
**CS1302 Introduction to Computer Programming**
___
```
%reload_ext mytutor
```
## Integers
**How to enter an [integer](https://docs.python.org/3/reference/lexical_analysis.html#integer-literals) in a program?**
```
15 # an integer in decimal
0b1111 # a binary number
0xF # hexadecimal (ba... | github_jupyter |
```
%%html
<link href="http://mathbook.pugetsound.edu/beta/mathbook-content.css" rel="stylesheet" type="text/css" />
<link href="https://aimath.org/mathbook/mathbook-add-on.css" rel="stylesheet" type="text/css" />
<style>.subtitle {font-size:medium; display:block}</style>
<link href="https://fonts.googleapis.com/css?fa... | 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 |
### CTCF Perturbation using SimpleNet
In this tutorial, we will learn how to use Ledidi to design genomic edits that affect CTCF binding in K562. For computational efficiency, we will use a very small neural network, named SimpleNet, in as the pre-trained oracle model that Ledidi relies on. SimpleNet can be run on a C... | github_jupyter |
# Introduction
This notebook demonstrates how to plot time series from the UKESM1 Geoengineering simulations
#### Firstly, import packages and define functions for calculations
```
'''Import packages for loading data, analysing, and plotting'''
import xarray
import matplotlib
import numpy
import cftime
%matplotlib i... | github_jupyter |
```
import pymc4 as pm
import tensorflow as tf
from fundl.datasets import make_graph_counting_dataset
from fundl.utils import pad_graph
import numpy as onp
import networkx as nx
import jax.numpy as np
from chemgraph import atom_graph
import janitor.chemistry
import pandas as pd
df = (
pd.read_csv("bace.csv")
.... | github_jupyter |
```
# -*- coding: utf-8 -*-
# @author: tongzi
# @description: Learing best practices for model evaluation and hyperparameter tuning
# @created date: 2019/08/30
# @last modification: 2019/08/30
# Import libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inl... | github_jupyter |
# Optimization Methods
Until now, you've always used Gradient Descent to update the parameters and minimize the cost. In this notebook, you'll gain skills with some more advanced optimization methods that can speed up learning and perhaps even get you to a better final value for the cost function. Having a good optimi... | github_jupyter |
```
import pandas as pd
dataset = pd.read_csv('housing.csv')
print(dataset.shape)
dataset[:5]
# Move 'medv' column to front
dataset = pd.concat([dataset['medv'], dataset.drop(['medv'], axis=1)], axis=1)
from sklearn.model_selection import train_test_split
training_dataset, validation_dataset = train_test_split(dataset... | github_jupyter |
# spectre Benchmarks
```
import pandas as pd
print('pandas', pd.__version__)
start, end = pd.Timestamp('2013-01-02', tz='UTC'), pd.Timestamp('2018-01-03', tz='UTC')
import sys
sys.path = ['..\\..\\spectre'] + sys.path
from spectre import factors, parallel, data
import pandas as pd
loader = data.ArrowLoader('../../hi... | github_jupyter |
<a href="https://colab.research.google.com/github/Yazanmy/ML/blob/master/Exercises_(Important_Python_Packages).ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
Ex1: Create a program that asks the user to enter their
name and their age. Print ou... | github_jupyter |
```
# load packages
import pandas as pd
import numpy as np
import seaborn as sns
import itertools
import statsmodels.api as sm
import matplotlib.pyplot as plt
plt.style.use('bmh')
import sys
import warnings
warnings.filterwarnings('ignore')
from IPython.display import display
# Further Markdown settings
# load librar... | github_jupyter |
```
from matplotlib import pyplot as plt
import numpy as np
import seaborn as sns
from matplotlib import rc
rc('text', usetex=True)
rc('text.latex', preamble=[r'\usepackage{sansmath}', r'\sansmath']) #r'\usepackage{DejaVuSans}'
rc('font',**{'family':'sans-serif','sans-serif':['DejaVu Sans']})
rc('xtick.major', pad=12... | github_jupyter |
# Problem Set 2: Classification
To run and solve this assignment, one must have a working IPython Notebook installation. The easiest way to set it up for both Windows and Linux is to install [Anaconda](https://www.continuum.io/downloads). Then save this file to your computer (use "Raw" link on gist\github), run Anacon... | github_jupyter |
```
import os
import sys
import re
from pathlib import Path
from IPython.display import display, HTML, Markdown
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import seaborn as sns
# Project level imports
from larval_gonad.note... | github_jupyter |
```
!pip install transformers==4.2.0
import sys
sys.path.append('/content/drive/MyDrive/MAIS')
import os
import numpy as np
import torch
from torch.nn import CrossEntropyLoss
from torch.utils.data import DataLoader, RandomSampler, SequentialSampler
from transformers import GPT2LMHeadModel, GPT2Config, AdamW, get_linea... | github_jupyter |
递归式特征消除Recursive feature elimination(RFE)
给定一个为特征(如线性模型的系数)分配权重的外部估计量,递归特征消除([RFE](https://scikit-learn.org/stable/modules/generated/sklearn.feature_selection.RFE.html#sklearn.feature_selection.RFE))就是通过递归地考虑越来越小的特征集来选择特征。首先,对初始特征集训练估计器,通过coef_属性或feature_importances_属性获得每个特征的重要性。然后,从当前的特征集中删除最不重要的特征。在经过修剪的集合上递归地重复这个过... | github_jupyter |
# Computing gradients in parallel with PennyLane-Braket
A central feature of the Amazon Braket SV1 simulator is that is can execute multiple circuits sent from PennyLane in parallel. This is crucial for scalable optimization, where each training step creates lots of variations of a circuit which need to be executed.
... | github_jupyter |
# Empirical Bayes for the Gaussian-Gaussian Hierarchical Model
A demonstration of how to estimate posterior group means in a Gaussian-Gaussian hierarchical model using Empirical Bayes. Based on Ch 5 of Murphy, Machine Learning.
Author: Juvid Aryaman
```
import numpy as np
import pandas as pd
import utls
import matpl... | github_jupyter |
```
# default_exp data.preparation
```
# Data preparation
> Functions required to prepare X (and y) from a pandas dataframe.
```
# export
from tsai.imports import *
from tsai.utils import *
from tsai.data.validation import *
from io import StringIO
#export
def df2Xy(df, sample_col=None, feat_col=None, data_cols=None... | github_jupyter |
# Create trip statistics
# Purpose
Before looking at the dynamics of the ferries from the time series it is a good idea to first look at some longer term trends. Statistics for each trip will be generated and saved as a first data reduction, to spot trends over the day/week/month and year.
# Methodology
* Trip statis... | github_jupyter |
```
%matplotlib inline
%load_ext autoreload
%autoreload 2
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import numpy as np
import pyro
import pyro.distributions as dist
import scipy as sp
import scipy.stats
import time
import torch
# Utilities
import scene_generation.data.planar_scene_arrangement... | github_jupyter |
# Undertale & Deltarune Soundtrack Generator
---
## Table of Contents
0. [**Table of Contents**](#Table-of-Contents)
1. [**Imports**](#Imports)
2. [**Data Processing**](#Data-Processing)
2.1 [Data Loading](#Data-Loading)
2.2 [Data Preprocessing](#Data-Preprocessing)
2.3 [Dataset & Dataloader... | github_jupyter |
For each of the following distributions:
1. --Bernoulli--
2. -Binomial-
3. -Poisson-
4. Gaussian
5. Uniform
6. Beta
A) Read up on what the formula for the probability distribution is and what sorts of problems it is used for
B) use Python, matplotlib and the scipy.stats to plot at least 2 unique parameters(or sets of... | github_jupyter |
# 텐서플로 기초
텐서플로 패키지를 임포트하여 아무런 에러가 나타나지 않으면 올바르게 설치된 것으로 보아도 됩니다.
```
import tensorflow as tf
```
## 상수
텐서플로는 계산 그래프라고 부르는 자료 구조를 먼저 만들고, 그다음 이를 실행하여 실제 계산을 수행합니다. 따라서 그래프를 만드는 구성(construction) 단계에서는 아무런 값을 얻을 수 없습니다.
다음은 텐서플로의 기본 자료형인 상수(constant)를 하나 만듭니다. c를 출력하면 값 1 대신 텐서(Tensor) 타입의 객체를 출력합니다.
```
c = tf.cons... | github_jupyter |
```
import logging
import threading
import itertools
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import axes3d
import seaborn as seabornInstance
from sqlalchemy import Column, Integer, String, Float, DateTime, Boolean, func
from iotfunct... | github_jupyter |
```
import os
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
os.environ["OMP_NUM_THREADS"] = "1"
import numpy as np
import pandas as pd
from pyscf import lib, gto, scf
import pyqmc.recipes
import h5py
import matplotlib.pyplot as plt
```
This function computes the mean-field solution and sa... | github_jupyter |
# Loading Image Data
So far we've been working with fairly artificial datasets that you wouldn't typically be using in real projects. Instead, you'll likely be dealing with full-sized images like you'd get from smart phone cameras. In this notebook, we'll look at how to load images and use them to train neural network... | github_jupyter |
```
from IPython.display import Image
```
# CNTK 103: Part B - Feed Forward Network with MNIST
We assume that you have successfully completed CNTK 103 Part A.
In this tutorial we will train a fully connected network on MNIST data. This notebook provides the recipe using Python APIs. If you are looking for this examp... | 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 |
# Training of a super simple model for celltype classification
```
import tensorflow as tf
!which python
!python --version
print(tf.VERSION)
print(tf.keras.__version__)
!pwd # start jupyter under notebooks/ for correct relative paths
import datetime
import inspect
import pandas as pd
import numpy as np
import seaborn... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
```
Import Danych z Filmwebu
```
data_path='https://raw.githubusercontent.com/mateuszrusin/ml-filmweb-score/master/oceny.csv'
marks = pd.read_csv(data_path)
marks.head(10)
```
Scalamy tytuł oryginalny z polskim
```
marks['... | github_jupyter |
```
import os
import re
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings('ignore')
from bs4 import BeautifulSoup
from sklearn.feature_extraction.text import CountVectorizer,TfidfVectorizer
from sklearn.ensemble import RandomForestCla... | github_jupyter |
# Use Decision Optimization to plan your diet with `ibm-watson-machine-learning`
This notebook facilitates Decision Optimization and Watson Machine Learning services. It contains steps and code to work with [ibm-watson-machine-learning](https://pypi.python.org/pypi/ibm-watson-machine-learning) library available in PyP... | github_jupyter |
# Kernel Derivatives
**Linear Operators and Stochastic Partial Differential Equations in GPR** - Simo Särkkä - [PDF](https://users.aalto.fi/~ssarkka/pub/spde.pdf)
> Expresses derivatives of GPs as operators
[**Demo Colab Notebook**](https://colab.research.google.com/drive/1pbb0qlypJCqPTN_cu2GEkkKLNXCYO9F2)
He looks... | github_jupyter |
```
# %%
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from matplotlib.animation import FuncAnimation
from scipy.stats import bernoulli
from svgpathtools import svg2paths
from svgpath2mpl import parse_path
# matplotlib parameters to ensure correctness... | github_jupyter |
(sec:hmm-ex)=
# Hidden Markov Models
In this section, we introduce Hidden Markov Models (HMMs).
## Boilerplate
```
# Install necessary libraries
try:
import jax
except:
# For cuda version, see https://github.com/google/jax#installation
%pip install --upgrade "jax[cpu]"
import jax
try:
import j... | github_jupyter |
```
#default_exp config
#hide
%load_ext autoreload
%autoreload 2
%load_ext line_profiler
#export
import torch
import datetime
import warnings
#hide
from fastcore.test import test_fail
```
# Config
Here we define a class `Config` to hold hyperparameters and global variables.
Design from https://github.com/cswinter/De... | github_jupyter |
ERROR: type should be string, got "https://docs.python.org/2/library/stdtypes.html\n\n5.1. Truth Value Testing\nAny object can be tested for truth value, for use in an if or while condition or as operand of the Boolean operations below. The following values are considered false:\n\n* None\n\n* False\n\n* zero of any numeric type, for example, 0, 0L, 0.0, 0j.\n\n* any empty sequence, for example, '', (), [].\n\n* any empty mapping, for example, {}.\n\n* instances of user-defined classes, if the class defines a __nonzero__() or __len__() method, when that method returns the integer zero or bool value False. [1]\n\nAll other values are considered true — so objects of many types are always true.\n\nOperations and built-in functions that have a Boolean result always return 0 or False for false and 1 or True for true, unless otherwise stated. (Important exception: the Boolean operations or and and always return one of their operands.)\n\n```\nprint('@when using False and None, they are always refer to same object, see ids below:')\nprint('id(False)', id(False), ', id(None)', id(None))\nprint('id(False)', id(False), ', id(None)', id(None))\nprint('id(False)', id(False), ', id(None)', id(None))\n```\n\n## Mutable vs Immutable Objects in Python\nhttps://medium.com/@meghamohan/mutable-and-immutable-side-of-python-c2145cf72747\n\nmutable object can be changed after it is created, and an immutable object can’t.\n\n* Objects of built-in types like (int, float, bool, str, tuple, unicode) are immutable. \n* Objects of built-in types like (list, set, dict) are mutable. \n* Custom classes are generally mutable.\n* To simulate immutability in a class, one should override attribute setting and deletion to raise exceptions.\n\n### Mutable objects\nObjects with same value may have diffent ids\n\n```\nprint('@when using empty mutable data type, they refer to differnt object, see ids below:')\nprint('Run 1: id(list()):', id(list()), ', id(dict()):', id(dict()), ', id(set()):', id(set())) \nprint('Run 2: id(list()):', id(list()), ', id(dict()):', id(dict()), ', id(set()):', id(set())) \nprint('Run 2: id(list()):', id(list()), ', id(dict()):', id(dict()), ', id(set()):', id(set())) \nprint('Run 4: id(list()):', id([]), ', id(dict()):', id({}))\nprint('Run 5: id(list()):', id([]), ', id(dict()):', id({}))\nprint('Run 6: id(list()):', id([]), ', id(dict()):', id({}))\nprint()\nprint('@but python will reuse same object if possible to be more efficient, e.g. :')\nprint('Run 1: id(list()):', id(list()), id([]), ', id(dict()):', id(dict()), id({}))\n```\n\n### Mutable objects evaluated as False\n\n* set() or {}\n* list() or [] \n* dict()\n\n```\n## print the truth values of the empty objects from these data types\nprint('@Truth values:',not not set(), not not {}, not not list(), not not [], not not dict())\nprint('@use two not operators, don\\'t use this: \\nExammple Code: print(1 and set())')\nprint('Output: \\'%s\\' is an object, not boolean value:' %(1 and set()))\n```\n\n### Immutable objects evaluated as False\n\n* zero of any numeric type\n* tuple()\n\n```\nprint('@Truth values:',not not 0, not not 0.0, not not complex(0), bool(0))\nprint('@Truth values:',not not tuple(), not not ())\n## empty tuple has same id\nprint(id(tuple()))\nprint('check follow:')\nprint(id(tuple()))\nprint(id(tuple()))\nprint(id(tuple()))\nprint(id(tuple()))\nprint(id(tuple()))\nprint(id(tuple()))\n```\n\n### Other objects evaluated as False\n* range(0)\n\n```\nprint(not not range(0))\n```\n\n" | github_jupyter |
## self-attention-cv : illustration of a training process with subvolume sampling for 3d segmentation
The dataset can be found here: https://iseg2019.web.unc.edu/ . i uploaded it and mounted from my gdrive
```
from google.colab import drive
drive.mount('/gdrive')
import zipfile
root_path = '/gdrive/My Drive/DATASETS/... | github_jupyter |
```
"""Simple tutorial following the TensorFlow example of a Convolutional Network.
Parag K. Mital, Jan. 2016"""
# %% Imports
import tensorflow as tf
import tensorflow.examples.tutorials.mnist.input_data as input_data
from libs.utils import *
# %% Setup input to the network and true output label. These are
# simply p... | github_jupyter |
## PHYS 105A: Introduction to Scientific Computing
# Random Numbers and Monte Carlo Methods
Chi-kwan Chan
* In physical science, students very often start with the concept that everything can be done exactly and deterministically.
* This can be one of the biggest misconcept!
* Many physical processes are non-dete... | github_jupyter |
<a href="https://colab.research.google.com/github/IMOKURI/wandb-demo/blob/main/WandB_Baseline_Image.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# 📔 About this notebook
Image classification baseline.
## 📝 Memo
# Check Environment
```
!free ... | github_jupyter |
# Iris dataset example
Example of functional keras model with named inputs/outputs for compatability with the keras/tensorflow toolkit.
```
from sklearn.datasets import load_iris
from tensorflow import keras
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Den... | github_jupyter |
# Can we find zero in less than 20 iterations ?
## The Quest for the Ultimate Optimizer - Episode 2
-------------------------------------------------------------------
This notebook is a continuation of the first episode of my Quest for the Ultimate Optimizer series of notebooks, which was inspired by DeepMind’s paper... | github_jupyter |
# Plot Deseq2
```
library("ggplot2")
library(tidyr)
```
## T2 PvL
```
sigtab = read.csv("pvl_t2.csv", row.names = 1)
sigtab = as.data.frame.matrix(sigtab)
#sigtab <- sigtab %>% drop_na(Genus)
sigtab
summary(sigtab$log2FoldChange)
x = 1
new = data.frame()
vector = c()
for (i in row.names(sigtab)){
temp = sigtab... | github_jupyter |
## Vorbereitung
```
import pandas as pd
# Platz für weitere Libraries, die Sie brauchen möchten...
import requests
from bs4 import BeautifulSoup
from urllib.parse import quote
```
Wir scrapen die hundert All-Time High Songs der Schweizer Hitparade
Quelle: https://hitparade.ch/charts/best/singles
Und suchen uns dann... | github_jupyter |
```
# Import Libraries
import numpy as np
import pandas as pd
from scipy.stats import iqr
import matplotlib.pyplot as plt
import matplotlib
import seaborn as sns
import pickle
from sklearn.preprocessing import OneHotEncoder, LabelEncoder
from sklearn.model_selection import train_test_split
from sklearn.linear_model i... | github_jupyter |
# Plagiarism Detection Model
Now that you've created training and test data, you are ready to define and train a model. Your goal in this notebook, will be to train a binary classification model that learns to label an answer file as either plagiarized or not, based on the features you provide the model.
This task wi... | github_jupyter |
```
import pathlib
import json
import shutil
import numpy as np
import matplotlib.pyplot as plt
from IPython import display
import pydicom
# Makes it so any changes in pymedphys is automatically
# propagated into the notebook without needing a kernel reset.
from IPython.lib.deepreload import reload
%load_ext autorel... | github_jupyter |
# CASPER example
In this jupyter notebook we will give an example of how some of the functions contained with Casper can be used to predict the concentration and shape parameter for a given cosmology as a function of mass and redshift. Additional functions can be used to plot the resulting density and circular velocit... | github_jupyter |

Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
# Logging
_**This notebook showcases var... | github_jupyter |
# Federated Learning of a Recurrent Neural Network for text classification
In this tutorial, you are going to learn how to train a Recurrent Neural Network (RNN) in a federated way with the purpose of *classifying* a person's surname to its most likely language of origin.
We will train two Recurrent Neural Networks... | github_jupyter |
# T81-558: Applications of Deep Neural Networks
**Module 3: Introduction to TensorFlow**
* Instructor: [Jeff Heaton](https://sites.wustl.edu/jeffheaton/), McKelvey School of Engineering, [Washington University in St. Louis](https://engineering.wustl.edu/Programs/Pages/default.aspx)
* For more information visit the [cla... | github_jupyter |
# Initial_t_rad Bug
The purpose of this notebook is to demonstrate the bug associated with setting the initial_t_rad tardis.plasma property.
```
pwd
import tardis
import numpy as np
```
# Density and Abundance test files
Below are the density and abundance data from the test files used for demonstrating this bug.
... | github_jupyter |
# Release 0.4.1 powered by heart zone metrics!
> New release of runpandas comes with heart training zone metrics and minor changes to the CI build actions.
- toc: false
- badges: true
- comments: true
- author: Marcel Caraciolo
- categories: [general, jupyter, releases]
- image: images/trainingpeaks.png
> This cur... | github_jupyter |
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W3D2_HiddenDynamics/W3D2_Tutorial4.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Bonus Tutorial 4: The Kalman Filter, part 2
**Week 3, Day 2... | github_jupyter |
# K-Means with Intel® Data Analytics Acceleration Library in Amazon SageMaker
## Introduction
Intel® Data Analytics Acceleration Library (Intel® DAAL) is the library of Intel® architecture optimized building blocks covering all stages of data analytics: data acquisition from a data source, preprocessing, transformati... | github_jupyter |
# Shor's Algorithm
Shor’s algorithm is famous for factoring integers in polynomial time. Since the best-known classical algorithm requires superpolynomial time to factor the product of two primes, the widely used cryptosystem, RSA, relies on factoring being impossible for large enough integers.
In this chapter we wil... | github_jupyter |
# REINFORCE in TensorFlow
Just like we did before for Q-learning, this time we'll design a TensorFlow network to learn `CartPole-v0` via policy gradient (REINFORCE).
Most of the code in this notebook is taken from approximate Q-learning, so you'll find it more or less familiar and even simpler.
```
import sys, os
if... | github_jupyter |
# TensorFlow Tutorial #03-B
# Layers API
by [Magnus Erik Hvass Pedersen](http://www.hvass-labs.org/)
/ [GitHub](https://github.com/Hvass-Labs/TensorFlow-Tutorials) / [Videos on YouTube](https://www.youtube.com/playlist?list=PL9Hr9sNUjfsmEu1ZniY0XpHSzl5uihcXZ)
## Introduction
It is important to use a builder API when... | github_jupyter |
# bulbea
> Deep Learning based Python Library for Stock Market Prediction and Modelling

A canonical way of importing the `bulbea` module is as follows:
```
import bulbea as bb
```
### `bulbea.Share`
In order to analyse a desired share, we use the `Share` object defined under `bulbea` which consider... | github_jupyter |
These exercises accompany the tutorial on [lists and tuples](https://www.kaggle.com/colinmorris/lists).
As always be sure to run the setup code below before working on the questions (and if you leave this notebook and come back later, don't forget to run the setup code again).
```
# SETUP. You don't need to worry for... | github_jupyter |
```
%reload_ext nb_black
# creating supervised learning imports
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.n... | github_jupyter |
<img src="../../images/banners/python-basics.png" width="600"/>
# <img src="../../images/logos/python.png" width="23"/> Dictionary
Python provides another composite data type called a dictionary, which is similar to a list in that it is a collection of objects.
## <img src="../../images/logos/toc.png" width="20"/> ... | github_jupyter |
<a href="https://colab.research.google.com/github/krmiddlebrook/intro_to_deep_learning/blob/master/machine_learning/lesson%202%20-%20logistic%20regression/logistic-regression.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Classification: Logistic... | github_jupyter |
# Feature Importance and Feature Selection With XGBoost
A benefit of using ensembles of decision tree methods like gradient boosting is that they can automatically provide estimates of feature importance from a trained predictive model.
Here you will discover how you can estimate the importance of features for a pre... | github_jupyter |
ERROR: type should be string, got "https://numpy.org/doc/stable/reference/arrays.datetime.html\n\n创建日期时间的最基本方法是使用ISO 8601日期或日期时间格式的字符串。 内部存储单位是从字符串形式中自动选择的,可以是日期单位或时间单位。\n日期单位是年('Y'),月('M'),周('W')和天('D'),而时间单位是小时('h'),分钟('m' ),秒(“ s”),毫秒(“ ms”)和一些其他基于SI前缀秒的单位。\ndatetime64数据类型还接受字符串“ NAT”(大小写字母的任意组合)作为“ Not A Time”值。\n\n```\nimport numpy as np\n# A simple ISO date:\n# Using months for the unit:\n# Specifying just the month, but forcing a ‘days’ unit:\n# From a date and time:\n# NAT (not a time):\nnp.datetime64('2005-02-25'),\\\nnp.datetime64('2005-02'),\\\nnp.datetime64('2005-02', 'D'),\\\nnp.datetime64('2005-02-25T03:30'),\\\nnp.datetime64('nat')\nnp.array(['2007-07-13', '2006-01-13', '2010-08-13'], dtype='datetime64'),\\\nnp.array(['2001-01-01T12:00', '2002-02-03T13:56:03.172'], dtype='datetime64')\n# 一个月的数据\nnp.arange('2005-02', '2005-03', dtype='datetime64[D]')\nnp.datetime64('2005') == np.datetime64('2005-01-01'),\\\nnp.datetime64('2010-03-14T15Z') == np.datetime64('2010-03-14T15:00:00.00Z')\n```\n\n## 日期时间和时间增量算法\n\n```\nnp.timedelta64(1, 'D'),\\\nnp.timedelta64(4, 'h'),\\\nnp.datetime64('2009-01-01') - np.datetime64('2008-01-01'),\\\nnp.datetime64('2009') + np.timedelta64(20, 'D'),\\\n np.datetime64('2011-06-15T00:00') + np.timedelta64(12, 'h'),\\\n np.timedelta64(1,'W') / np.timedelta64(1,'D'),\\\n np.timedelta64(1,'W') % np.timedelta64(10,'D'),\\\n np.datetime64('nat') - np.datetime64('2009-01-01'),\\\n np.datetime64('2009-01-01') + np.timedelta64('nat')\n```\n\n日期单位:\n\n| Code | Meaning | Time span \\(relative\\) | Time span \\(absolute\\) |\n|------|---------|------------------------|----------------------------|\n| Y | year | \\+/\\- 9\\.2e18 years | \\[9\\.2e18 BC, 9\\.2e18 AD\\] |\n| M | month | \\+/\\- 7\\.6e17 years | \\[7\\.6e17 BC, 7\\.6e17 AD\\] |\n| W | week | \\+/\\- 1\\.7e17 years | \\[1\\.7e17 BC, 1\\.7e17 AD\\] |\n| D | day | \\+/\\- 2\\.5e16 years | \\[2\\.5e16 BC, 2\\.5e16 AD\\] |\n\n时间单位:\n\n| Code | Meaning | Time span \\(relative\\) | Time span \\(absolute\\) |\n|------|-------------|------------------------|----------------------------|\n| h | hour | \\+/\\- 1\\.0e15 years | \\[1\\.0e15 BC, 1\\.0e15 AD\\] |\n| m | minute | \\+/\\- 1\\.7e13 years | \\[1\\.7e13 BC, 1\\.7e13 AD\\] |\n| s | second | \\+/\\- 2\\.9e11 years | \\[2\\.9e11 BC, 2\\.9e11 AD\\] |\n| ms | millisecond | \\+/\\- 2\\.9e8 years | \\[ 2\\.9e8 BC, 2\\.9e8 AD\\] |\n| us | microsecond | \\+/\\- 2\\.9e5 years | \\[290301 BC, 294241 AD\\] |\n| ns | nanosecond | \\+/\\- 292 years | \\[ 1678 AD, 2262 AD\\] |\n| ps | picosecond | \\+/\\- 106 days | \\[ 1969 AD, 1970 AD\\] |\n| fs | femtosecond | \\+/\\- 2\\.6 hours | \\[ 1969 AD, 1970 AD\\] |\n| as | attosecond | \\+/\\- 9\\.2 seconds | \\[ 1969 AD, 1970 AD\\] |\n\n\n工作日功能:\nbusday功能的默认设置是唯一有效的日期是星期一至星期五(通常的工作日)。\n该实现基于包含7个布尔值标志的“周掩码”,以指示有效日期; 可以使用自定义周掩码来指定其他有效日期集。\n\n“ busday”功能还可以检查“假期”列表,这些日期不是有效的日期。\n\n功能busday_offset使您可以将工作日中指定的偏移量以“ D”(天)为单位应用于日期时间。\n\n```\nnp.busday_offset('2011-06-23', 1),\\\nnp.busday_offset('2011-06-23', 2),\\\nnp.busday_offset('2011-06-25', 0, roll='forward'),\\\nnp.busday_offset('2011-06-25', 2, roll='forward'),\\\nnp.busday_offset('2011-06-25', 0, roll='backward'),\\\nnp.busday_offset('2011-06-25', 2, roll='backward'),\\\nnp.busday_offset('2011-03-20', 0, roll='forward'),\\\nnp.busday_offset('2011-03-22', 0, roll='forward'),\\\nnp.busday_offset('2011-03-20', 1, roll='backward'),\\\nnp.busday_offset('2011-03-22', 1, roll='backward'),\\\nnp.busday_offset('2012-05', 1, roll='forward', weekmask='Sun')\n\"\"\"\n# Positional sequences; positions are Monday through Sunday.\n# Length of the sequence must be exactly 7.\nweekmask = [1, 1, 1, 1, 1, 0, 0]\n# list or other sequence; 0 == invalid day, 1 == valid day\nweekmask = \"1111100\"\n# string '0' == invalid day, '1' == valid day\n\n# string abbreviations from this list: Mon Tue Wed Thu Fri Sat Sun\nweekmask = \"Mon Tue Wed Thu Fri\"\n# any amount of whitespace is allowed; abbreviations are case-sensitive.\nweekmask = \"MonTue Wed Thu\\tFri\"\n\"\"\"\na = np.arange(np.datetime64('2011-07-11'), np.datetime64('2011-07-18'))\n\nnp.is_busday(np.datetime64('2011-07-15')),\\\n np.is_busday(np.datetime64('2011-07-16')),\\\n np.is_busday(np.datetime64('2011-07-16'), weekmask=\"Sat Sun\"),\\\n np.is_busday(a)\na = np.arange(np.datetime64('2011-07-11'), np.datetime64('2011-07-18'))\n\nnp.busday_count(np.datetime64('2011-07-11'), np.datetime64('2011-07-18')),\\\n np.busday_count(np.datetime64('2011-07-18'), np.datetime64('2011-07-11')),\\\n np.count_nonzero(np.is_busday(a))\n```\n\n" | github_jupyter |
# Section 1.2 Model Fitting
```
import pymc3 as pm
import numpy as np
import arviz as az
import matplotlib.pyplot as plt
az.style.use('arviz-white')
```
## Activity 1: Estimate the Proportion of Water
Now it's your turn to work through an example inspired from Richard McElreath's excellent book [Statistical Rethinki... | github_jupyter |
```
!pip install scikit-learn==1.0.2 statsmodels yellowbrick python-slugify sagemaker==2.88.0 s3fs
```
# Data cleaning and Feature engineering
```
import os
import numpy as np
import pandas as pd
import warnings
warnings.filterwarnings("ignore")
import plotly.offline as py
import plotly.graph_objs as go
import plotly... | github_jupyter |
Before you turn this problem in, make sure everything runs as expected. First, **restart the kernel** (in the menubar, select Kernel$\rightarrow$Restart) and then **run all cells** (in the menubar, select Cell$\rightarrow$Run All).
Make sure you fill in any place that says `YOUR CODE HERE` or "YOUR ANSWER HERE", as we... | github_jupyter |
# Image augmentation strategies:
## Author: Dr. Rahul Remanan
### (CEO and Chief Imagination Officer, [Moad Computer](https://www.moad.computer))
### Demo data: [Kaggle Cats Vs. Dogs Redux](https://www.kaggle.com/c/dogs-vs-cats-redux-kernels-edition)
## Part 01 - [Using Keras pre-processing:](https://blog.keras.io/... | github_jupyter |
```
from molmap import model as molmodel
import molmap
import matplotlib.pyplot as plt
import pandas as pd
from tqdm import tqdm
from joblib import load, dump
tqdm.pandas(ascii=True)
import numpy as np
import tensorflow as tf
import os
os.environ["CUDA_VISIBLE_DEVICES"]="1"
np.random.seed(123)
tf.compat.v1.set_rando... | github_jupyter |
###### Content under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2017 L.A. Barba, N.C. Clementi
```
# Execute this cell to load the notebook's style sheet, then ignore it
from IPython.core.display import HTML
css_file = '../style/custom.css'
HTML(open(css_file, "r").read())
```
#... | github_jupyter |
# Building your First Model in Alteryx
Having built the model from Lesson 3-22 in alteryx, I wanted to try if I can get the same results with Python and statsmodels. It was surprisingly easy to code the model. For the first part, I had to extend the excel data from the given format
<img src="3-22-excel-1.png" width=5... | github_jupyter |
# ResNet-50
- Landmark 분류 모델
# GPU 확인
```
import numpy as np
import pandas as pd
import keras
import tensorflow as tf
from IPython.display import display
import PIL
# How to check if the code is running on GPU or CPU?
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
fr... | github_jupyter |
# Ens'IA - Session 1 - Introduction to machine learning
```
import keras
from keras.datasets import cifar10
from matplotlib import pyplot as plt
import numpy as np
import math
%matplotlib inline
```
To introduce you to the main notions of Machine Learning, we will present two basic algorithms: KNN and K-MEANS.
They ... | github_jupyter |
```
from __future__ import absolute_import, division, print_function, unicode_literals
import tensorflow as tf
tf.enable_eager_execution()
import numpy as np
import os
import time
# from lossT import sparse_categorical_crossentropy
```
### Parameters
```
# Spatially discretized data into 20 bins
bins=np.arange(-0.9, ... | github_jupyter |
# Introduction to Python SQL Libraries
Source: https://realpython.com/python-sql-libraries/#deleting-table-records
Tools: DB Brower for SQlite, website https://sqlitebrowser.org/
All software applications interact with data, most commonly through a database management system (DBMS). Some programming languages come w... | github_jupyter |
# Advanced SQL II: Subqueries
_**Author**: Boom Devahastin Na Ayudhya_
***
## Additional Learning Tools after the course
The dataset I've used for this lesson is from [Udemy's Master SQL for Data Science](https://www.udemy.com/master-sql-for-data-science/learn/lecture/9790570#overview) course. In the repo, you should... | github_jupyter |
#Spectral clustering para documentos
El clustering espectral es una técnica de agrupamiento basada en la topología de gráficas. Es especialmente útil cuando los datos no son convexos o cuando se trabaja, directamente, con estructuras de grafos.
##Preparación d elos documentos
Trabajaremos con documentos textuales. E... | github_jupyter |
# Qiskit Aer: Noise Transformation
The latest version of this notebook is available on https://github.com/Qiskit/qiskit-iqx-tutorials.
## Introduction
This notebook shows how to use the Qiskit Aer utility functions `approximate_quantum_error` and `approximate_noise_model` to transform quantum noise channels into a d... | github_jupyter |
# Lab 9 Quantum Simulation as a Search Algorithm
Prerequisites:
- [Ch.3.8 Grover's Algorithm](https://qiskit.org/textbook/ch-algorithms/grover.html)
- [Ch.2.5 Proving Universality](https://qiskit.org/textbook/ch-gates/proving-universality.html#2.2-Unitary-and-Hermitian-matrices-)
Other relevant materials:
- [Ch 6.2 i... | github_jupyter |
# Orders of Magnitude
The simulation examples in the previous chapters are conceptual. As we begin to build simulation models of realistic biological processes, the need to obtain information such as the numerical values of the parameters that appear in the dynamic mass balances. We thus go through a process of estimat... | github_jupyter |
## Programming Exercise 3: Multi-class Classification and Neural Networks
#### Author - Rishabh Jain
```
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
%matplotlib inline
from scipy.io import loadmat
```
### 1 Multi-class Classification
##### Prob... | github_jupyter |
```
import pandas as pd
import pyspark.sql.functions as F
from pyspark.sql.types import *
pd.set_option("display.max_rows", 101)
pd.set_option("display.max_columns", 101)
```
<hr />
### reading preprocessed dataframes
```
srag_2021 = spark.read.parquet('gs://ai-covid19-datalake/standard/srag/pp_interm_srag_2021_v3_n... | github_jupyter |
# Naive Sentence to Emoji Translation
## Purpose
To workshop a naive version of an sentence to emoji translation algorithm. The general idea is that sentences can be "chuncked" out into n-grams that are more related to a single emoji. The related-ness of an n-gram to an emoji is directly related to the cosine similari... | github_jupyter |
## Problem Statement
Previously, we considered the following problem:
>Given a positive integer `n`, write a function, `print_integers`, that uses recursion to print all numbers from `n` to `1`.
>
>For example, if `n` is `4`, the function shuld print `4 3 2 1`.
Our solution was:
```
def print_integers(n):
if ... | github_jupyter |
# Caso de estudio - Supervivencia en el Titanic
# Extracción de características
Ahora trataremos parte muy importante del aprendizaje automático: la extracción de características cuantitativas a partir de los datos. Con este fin:
- Aprenderemos como las características pueden extraerse a partir de datos del mundo rea... | github_jupyter |
# Estimating an AR Model
## Introduction to Autoregression Model
An autoregression model is a regression with a time series and itself, shifted by a time step or steps. These are called lags. I will demonstrate with five examples with the non-stationarized datasets so that you can see the results in the original dat... | github_jupyter |
# Prediksi Predikat Lulus
## Drive - Colab
```
from google.colab import drive
from google.colab import files
drive.mount('/content/drive')
%cd /content/drive/MyDrive/ai_contest/Kelulusan/olah
```
## Import Modules
```
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
```
## D3
```
df = pd.rea... | github_jupyter |
```
import os
import numpy as np
from glob import glob
import re
import time
import shutil
from tqdm import tqdm
directory_map = {
'rccc': {
'search_string': r'\\monacoda\FocalData\RCCC\1~Clinical\*~*\demographic.*',
'holding': r'\\monacoda\FocalData\ToBeArchived',
'archived': r'\\UTILSVR\Ph... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.