code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
# dMRI Data Reconstruction
In this notebook, we will reconstruct MRI imgaes from raw data by using Python.This includes: 1. Data processing; 2. DTI reconstruction and 3. DKI reocnstruction.
## Data Preprocessing
Data preprocessing is quit important for dMRI reconstruction. Different data preprocessing may lead to di... | github_jupyter |
<font size=6 color='violet'>Introduction</font>

In this dataset, we are provided with game analytics for the PBS KIDS Measure Up! app. In this app, children navigate a map and complete v... | github_jupyter |
```
# Import needed packages in PEP 8 order (no unused imports listed) (4 points total)
# Import required libraries here
import os
import matplotlib.pyplot as plt
import seaborn as sns
import requests
import urllib
import folium
import numpy as np
import pandas as pd
from pandas.io.json import json_normalize
import ge... | github_jupyter |
# Batch Normalization – Practice
Batch normalization is most useful when building deep neural networks. To demonstrate this, we'll create a convolutional neural network with 20 convolutional layers, followed by a fully connected layer. We'll use it to classify handwritten digits in the MNIST dataset, which should be f... | github_jupyter |
```
from imports import *
import pickle
# device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
device = torch.device("cuda:0")
2048*6*10
def get_encoder(model_name):
if model_name == 'mobile_net':
md = torchvision.models.mobilenet_v2(pretrained=True)
encoder = nn.Seq... | github_jupyter |
# Write custom inference script and requirements to local folder
```
! mkdir inference_code
%%writefile inference_code/inference.py
# This is the script that will be used in the inference container
import os
import json
import torch
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
def model_fn(model_d... | github_jupyter |
**[Pandas Home Page](https://www.kaggle.com/learn/pandas)**
---
# Introduction
In these exercises we'll apply groupwise analysis to our dataset.
Run the code cell below to load the data before running the exercises.
```
import pandas as pd
reviews = pd.read_csv("../input/wine-reviews/winemag-data-130k-v2.csv", in... | github_jupyter |
# An Introduction to $\LaTeX$ (LaTeX)
Latex is a typesetting language used for formatting equations (and much more) in the scientific communities. LaTeX is used very commonly in higher mathematical and computer science classes and academia. In Stat 140, we'll be using LaTeX to "pretty print" equations and answers for ... | github_jupyter |
## **Thermodynamics: an Engineering Approach, 7th Ed**
Cengel & Boles
# Chapter 1: Introduction and Basic Concepts
##Example 1-1, Page.8
```
#Diketahui:
El_USD = 0.09 # Harga Listrik adalah 0.09 $/kWh
P_wt = 30 # Wind Turbine power rate, kW
t_wt = 2200 # Durasi kerja Wind Turbine dalam satu tahun, hours
#Dicari: p... | github_jupyter |
# Assignment 1
We are given a 2-dimensional grid with points $(i, j)$, $i, j = 0, \dots, N+1$. In this assignment we want to simulate a discrete diffusion process on the grid. We are starting with a distribution $u_0(i, j)$ of function values on the grid points. The distribution process follows the following recurrenc... | github_jupyter |
# Ejercicio: 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 ... | github_jupyter |
```
# Copyright 2020 IITK EE604A Image Processing. All Rights Reserved.
#
# Licensed under the MIT License. Use and/or modification of this code outside of EE604 must reference:
#
# © IITK EE604A Image Processing
# https://github.com/ee604/ee604_assignments
#
# Author: Shashi Kant Gupta, Chiranjeev Prachand and Prof ... | github_jupyter |
## Machine Learning Model Building Pipeline: Wrapping up for Deployment
In the previous lectures, we worked through the typical Machine Learning pipeline to build a regression model that allows us to predict house prices. Briefly, we transformed variables in the dataset to make them suitable for use in a Regression m... | github_jupyter |
```
# super comms script
import serial
from time import sleep
import math
from tqdm import *
import json
def set_target(motor, location, ser, output=True):
if ser.is_open:
if motor =='A':
ser.write(b'A')
else:
ser.write(b'B')
target_bytes = location.to_bytes... | github_jupyter |
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.

Yves Hilpisch
<img style="border:0px solid grey;" src="http://hilpisch.com/python_for_finance.png" alt="Python for Finance" width="30%" a... | github_jupyter |
<a href="https://colab.research.google.com/github/tensorflow/tpu/blob/master/tools/colab/keras_mnist_tpu.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
##### Copyright 2018 The TensorFlow Hub Authors.
Licensed under the Apache License, Version 2.0... | github_jupyter |
# 第6章 スモール言語を作る
```
# !pip install pegtree
import pegtree as pg
from pegtree.colab import peg, pegtree, example
%%peg
Program = { // 開式非終端記号 Expression*
#Program
} EOF
EOF = !. // ファイル終端
Expression =
/ FuncDecl // 関数定義
/ VarDecl // 変数定義
/ IfExpr // if 式
/ Binary // 二項演算
```
import pegtree as ... | github_jupyter |
# SQL in Python
### Packages
- [Pandas.read_sql](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_sql.html)
- [SQLite3](https://docs.python.org/3.6/library/sqlite3.html)
### Tutorials
- https://www.tutorialspoint.com/sqlite/sqlite_python.htm
- https://www.pythoncentral.io/introduction-to-sqli... | github_jupyter |
# Data Space Report
<img src="images/polito_logo.png" alt="Polito Logo" style="width: 200px;"/>
## Pittsburgh Bridges Data Set
<img src="images/andy_warhol_bridge.jpg" alt="Andy Warhol Bridge" style="width: 200px;"/>
Andy Warhol Bridge - Pittsburgh.
Report created by Student Francesco Maria Chiarlo s253666, ... | github_jupyter |
## Dataset
https://data.wprdc.org/dataset/allegheny-county-restaurant-food-facility-inspection-violations/resource/112a3821-334d-4f3f-ab40-4de1220b1a0a
This data set is a set of all of the restaurants in Allegheny County with geographic locations including zip code, size, description of use, and a "status" ranging fro... | github_jupyter |
```
from tensorflow import keras
from tensorflow.keras import *
from tensorflow.keras.models import *
from tensorflow.keras.layers import *
from tensorflow.keras.regularizers import l2#正则化L2
import tensorflow as tf
import numpy as np
import pandas as pd
normal = np.loadtxt(r'F:\张老师课题学习内容\code\数据集\试验数据(包括压力脉动和振动)\2013.9... | github_jupyter |
# Dimensionality Reduction Example
Using the IMDB data, feature matrix and apply dimensionality reduction to this matrix via PCA and SVD.
```
%matplotlib inline
import json
import random
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.sparse import lil_matrix
from sklearn.neighbor... | github_jupyter |
# 1. Workflow for building and deploying interactive dashboards
**Let's say you want to make it easy to explore some dataset. That is, you want to:**
* Make a visualization of the data
* Maybe add some custom widgets to see the effects of some variables
* Then deploy the result as a web app.
**You can definitely do... | github_jupyter |
# SKLearn Spacy Reddit Text Classification Example
In this example we will be buiding a text classifier using the reddit content moderation dataset.
For this, we will be using SpaCy for the word tokenization and lemmatization.
The classification will be done with a Logistic Regression binary classifier.
The steps ... | github_jupyter |
## Image segmentation with CamVid
```
%reload_ext autoreload
%autoreload 2
%matplotlib inline
from fastai import *
from fastai.vision import *
from fastai.callbacks.hooks import *
```
The One Hundred Layer Tiramisu paper used a modified version of Camvid, with smaller images and few classes. You can get it from the C... | github_jupyter |
##Laboratorio 2
#cumplir con cada uno de los 9 retos en sus grupos de trabajo
#y subir el Colab a el repositorio de un seleccionado,
for: 30/05/2022 12:59
##1. Define a procedure histogram () that takes a list of whole numbers and prints a histogram on the screen. Example: procedure ([4, 9, 7]) should print the foll... | 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 |
# Equilibrium analysis Chemical reaction
Number (code) of assignment: 2N4
Description of activity:
Report on behalf of:
name : Pieter van Halem
student number : 4597591
name : Dennis Dane
student number :4592239
Data of student taking the role of contact person:
name :
email address :
```
import numpy as n... | github_jupyter |
# Creating a simple PDE model
In the [previous notebook](./1-an-ode-model.ipynb) we show how to create, discretise and solve an ODE model in pybamm. In this notebook we show how to create and solve a PDE problem, which will require meshing of the spatial domain.
As an example, we consider the problem of linear diffus... | github_jupyter |
# Writing Functions
This lecture discusses the mechanics of writing functions and how to encapsulate scripts as functions.
```
# Example: We're going to use Pandas dataframes to create a gradebook for this course
import pandas as pd
# Student Rosters:
students = ['Hao', 'Jennifer', 'Alex']
# Gradebook columns:
col... | github_jupyter |
# Identificando y modelando relaciones entre pares de variables

> En la sesión anterior introdujimos el lenguaje de programación Python, y la librería de análisis de datos para Python **Pandas**. Con Pandas, aprendimos a:
- Cargar datos desde arc... | github_jupyter |
# 线性回归
:label:`sec_linear_regression`
*回归*(regression)是能为一个或多个自变量与因变量之间关系建模的一类方法。
在自然科学和社会科学领域,回归经常用来表示输入和输出之间的关系。
在机器学习领域中的大多数任务通常都与*预测*(prediction)有关。
当我们想预测一个数值时,就会涉及到回归问题。
常见的例子包括:预测价格(房屋、股票等)、预测住院时间(针对住院病人等)、
预测需求(零售销量等)。
但不是所有的*预测*都是回归问题。
在后面的章节中,我们将介绍分类问题。分类问题的目标是预测数据属于一组类别中的哪一个。
## 线性回归的基本元素
*线性回归*(linear r... | github_jupyter |
# Project Submission
Continuous Control for the Udacity Ud893 Deep Reinforcement Learning Nanodegree (DRLND)
## Imports and Dependencies
```
import sys
sys.path.append("../python")
import random
import numpy as np
import torch
from collections import deque
import matplotlib.pyplot as plt
from datetime import datetim... | github_jupyter |
## Load Model, plain 2D Conv
```
import os
os.chdir("../..")
os.getcwd()
import numpy as np
import torch
import json
from distributed.model_util import choose_model, choose_old_model, load_model, extend_model_config
from distributed.util import q_value_index_to_action
import matplotlib.pyplot as plt
model_name = "conv... | github_jupyter |
```
ls ../test-data/
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tables as tb
import h5py
import dask.dataframe as dd
import dask.bag as db
import blaze
fname = '../test-data/EQY_US_ALL_BBO_201402/EQY_US_ALL_BBO_20140206.h5'
max_sym = '/SPY/no_suffix'
fname = '../tes... | github_jupyter |
**Copyright 2021 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 ag... | github_jupyter |
# Testing cnn for classifying universes
Nov 10, 2020
```
import argparse
import os
import random
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
from torchsummary import summary
from torch.utils.data import DataLoade... | github_jupyter |
# User Demo
```
url = "http://127.0.0.1:5000"
filepath = 'C:\\Users\\reonh\Documents\\NUS\AY2022_S1\Capstone\capstone_21\python_backend\database\lpdlprnet\plate_2.jpg'
folderpath = 'C:\\Users\\reonh\Documents\\NUS\AY2022_S1\Capstone\capstone_21\python_backend\database\lpdlprnet\\'
filename = 'plate.jpg'
```
## Che... | github_jupyter |
#### Abstract Classes: contains abstract methods
Abstract methods are those which are only declared but they've no implementation
**All methods need to be implemented (mandatory)
Module -- abc
|
|
|---> ABC (Class)
|
|---> Abstract method ... | github_jupyter |
```
#imports
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import GridSearchCV
from sklearn.svm import SVC
from sklearn import metrics
from sklearn.tree import DecisionTreeClassifier
from sklearn.linear_model import LogisticRegression... | github_jupyter |
```
# This mounts your Google Drive to the Colab VM.
from google.colab import drive
drive.mount('/content/drive')
# TODO: Enter the foldername in your Drive where you have saved the unzipped
# assignment folder, e.g. 'cs231n/assignments/assignment1/'
FOLDERNAME = None
assert FOLDERNAME is not None, "[!] Enter the fold... | github_jupyter |
# [Dictionaries](https://docs.python.org/3/library/stdtypes.html#dict)
Collections of `key`-`value` pairs.
```
my_empty_dict = {} # alternative: my_empty_dict = dict()
print('dict: {}, type: {}'.format(my_empty_dict, type(my_empty_dict)))
```
## Initialization
```
dict1 = {'value1': 1.6, 'value2': 10, 'name': 'Joh... | github_jupyter |
```
import re
import tweepy
from tweepy import OAuthHandler
from textblob import TextBlob
class TwitterClient(object):
'''
Generic Twitter Class for sentiment analysis.
'''
def __init__(self):
'''
Class constructor or initialization method.
'''
# keys and tokens from the ... | github_jupyter |
##### Copyright 2018 The TensorFlow Authors. [Licensed under the Apache License, Version 2.0](#scrollTo=bPJq2qP2KE3u).
```
// #@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 |
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Libraries-and-functions" data-toc-modified-id="Libraries-and-functions-1"><span class="toc-item-num">1 </span>Libraries and functions</a></span><ul class="toc-item"><li><span><a href="#Import-lib... | github_jupyter |
# Segmentation
Image segmentation is another early as well as an important image processing task. Segmentation is the process of breaking an image into groups, based on similarities of the pixels. Pixels can be similar to each other in multiple ways like brightness, color, or texture. The segmentation algorithms are t... | github_jupyter |
<center>
<img src="https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-ML0101EN-SkillsNetwork/labs/Module%203/images/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" />
</center>
# Decision Trees
Estimated time needed: **15** minutes
## Objectives
After completing... | github_jupyter |
# Results Analysis
This notebook analyzes results produced by the _anti-entropy reinforcement learning_ experiments. The practical purpose of this notebook is to create graphs that can be used to display anti-entropy topologies, but also to extract information relevant to each experimental run.
```
%matplotlib noteb... | github_jupyter |
```
# reload packages
%load_ext autoreload
%autoreload 2
```
### Choose GPU (this may not be needed on your computer)
```
%env CUDA_DEVICE_ORDER=PCI_BUS_ID
%env CUDA_VISIBLE_DEVICES=1
import tensorflow as tf
gpu_devices = tf.config.experimental.list_physical_devices('GPU')
if len(gpu_devices)>0:
tf.config.experim... | github_jupyter |
# **Space X Falcon 9 First Stage Landing Prediction**
## Web scraping Falcon 9 and Falcon Heavy Launches Records from Wikipedia
We will be performing web scraping to collect Falcon 9 historical launch records from a Wikipedia page titled `List of Falcon 9 and Falcon Heavy launches`
[https://en.wikipedia.org/wiki/Li... | github_jupyter |
# 여러그림 그리기
> 여러그림 그리기, Anscombe's quartet
- toc: true
- branch: master
- badges: true
- comments: true
- author: dinonene
- categories: [python]
`-` (1/2) 여러그림그리기
`-` (2/2) Anscombe's quartet
### 여러그림 그리기
#### (1) 겹쳐그리기
```
import numpy as np
import matplotlib.pyplot as plt
x=np.arange(-5,5,0.1)
y=2*x+np.random.no... | github_jupyter |
```
# Basic Modules for data and text processing
import pandas as pd
import numpy as np
import string
import nltk
import re
from nltk.corpus import stopwords
from nltk.stem.snowball import SnowballStemmer
from sklearn.model_selection import train_test_split
# Keras Modules
from keras.preprocessing.text import Tokeniz... | github_jupyter |
# Importing Important File regarding Analysis
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
import datetime as dt
import time
import ipywidgets
#from ipython.display import display
data1 = pd.read_csv("covid_19_india (1).csv",dayfirst=True)
data1
``... | github_jupyter |
```
import pandas as pd
import numpy as np
import sys
from sklearn.preprocessing import LabelEncoder,OneHotEncoder
from sklearn.feature_selection import RFE
from sklearn.tree import DecisionTreeClassifier
from sklearn import preprocessing
col_names = ["duration","protocol_type","service","flag","src_bytes",
"dst_by... | github_jupyter |
# FINAL PROJECT
In the final project, you will create a closed loop system for an SBML model.
Start by selecting a model from the [BioModels Curated branch](https://www.ebi.ac.uk/biomodels/search?query=*%3A*+AND+curationstatus%3A%22Manually+curated%22&domain=biomodels).)
You don't have to restrict yourself to thoses m... | github_jupyter |
# Movielens EDA and Modeling
> EDA and modeling on movielens dataset
- toc: true
- badges: true
- comments: true
- categories: [EDA, Movie, Visualization]
- image:
## Setup
```
# download dataset
!wget http://files.grouplens.org/datasets/movielens/ml-100k.zip && unzip ml-100k.zip
!wget http://files.grouplens.org/dat... | github_jupyter |
# "Covid-19, आपका समुदाय और आप - एक डेटा विज्ञान परिप्रेक्ष्य"
> "लिखित: 09 मार्च 2020 जेरेमी हावर्ड और रेचल थॉमस द्वारा"
- toc: false
- badges: false
- comments: true
- categories: [ai-in-society]
- image: images/coronavirus.jpg
> हम डेटा वैज्ञानिक हैं - अर्थात, हमारा काम यह समझना है कि हम डेटा का विश्लेषण और व्याख... | github_jupyter |
# Visuals
This notebook contains visual output functions for Constitutive Models, more specifically for a bounding surface model by Borjas & Amies, 1994. The functions are developed and maintained by Justin Bonus (University of Washington).
Use ``%run YOURPATH/'Bounding Surface'/Visuals.ipynb`` at the start of your n... | github_jupyter |
Branching GP Regression on hematopoietic data
--
*Alexis Boukouvalas, 2017*
**Note:** this notebook is automatically generated by [Jupytext](https://jupytext.readthedocs.io/en/latest/index.html), see the README for instructions on working with it.
test change
Branching GP regression with Gaussian noise on the hemat... | github_jupyter |
### A Jupyter Notebook exploring the Scipy.Stats module for Python. [scipy.stats offfical](https://docs.scipy.org/doc/scipy/reference/stats.html)
The Scipy.Stats module for Python offers a wide array of probability distributions, summary and frequency statistics, correlation functions and statistical tests, masked stat... | github_jupyter |
```
%matplotlib inline
import itertools
import os
os.environ['CUDA_VISIBLE_DEVICES']=""
import numpy as np
import gpflow
import gpflow.training.monitor as mon
import numbers
import matplotlib.pyplot as plt
import tensorflow as tf
```
# Demo: `gpflow.training.monitor`
In this notebook we'll demo how to use `gpflow.trai... | github_jupyter |
```
from resources.workspace import *
%matplotlib inline
```
## Dynamical systems
are systems (sets of equations) whose variables evolve in time (the equations contains time derivatives). As a branch of mathematics, its theory is mainly concerned with understanding the behaviour of solutions (trajectories) of the syst... | github_jupyter |
<img width="10%" alt="Naas" src="https://landen.imgix.net/jtci2pxwjczr/assets/5ice39g4.png?w=160"/>
# IUCN - Extinct species
<a href="https://app.naas.ai/user-redirect/naas/downloader?url=https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/IUCN/IUCN_Extinct_species.ipynb" target="_parent"><img src=... | github_jupyter |
```
#importing modules
import cv2
import numpy as np
import math
import time
import _thread
import wave
import struct
def playSound(name):
import simpleaudio as sa
wave_obj = sa.WaveObject.from_wave_file(name)
play_obj = wave_obj.play()
####CRASHES ON FAST INPUT####
# import pyglet
# player ... | github_jupyter |
# Can I predict how much people will spend online?
### Insights from Google Analytics data
```
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import plotly.express as px
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv('mergedGAdata.csv')
print(df.shape)
```
# Wrangling
... | github_jupyter |
```
import keras
keras.__version__
```
# 영화 리뷰 분류: 이진 분류 예제
이 노트북은 [케라스 창시자에게 배우는 딥러닝](https://tensorflow.blog/케라스-창시자에게-배우는-딥러닝/) 책의 3장 4절의 코드 예제입니다. 책에는 더 많은 내용과 그림이 있습니다. 이 노트북에는 소스 코드에 관련된 설명만 포함합니다. 이 노트북의 설명은 케라스 버전 2.2.2에 맞추어져 있습니다. 케라스 최신 버전이 릴리스되면 노트북을 다시 테스트하기 때문에 설명과 코드의 결과가 조금 다를 수 있습니다. (현재 내가 사용하는 것은 케라... | github_jupyter |
# ThaiNER (Bi-LSTM CRF)
using pytorch
By Mr.Wannaphong Phatthiyaphaibun
Bachelor of Science Program in Computer and Information Science, Nong Khai Campus, Khon Kaen University
https://iam.wannaphong.com/
E-mail : wannaphong@kkumail.com
Thank you Faculty of Applied Science and Engineering, Nong Khai Campus, Khon K... | github_jupyter |
# Flight Price Prediction
---
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
pip list
```
## Importing dataset
1. Check whether any null values are there or not. if it is present then following can be done,
1. Imputing data using Imputation method in s... | github_jupyter |
<a href="https://colab.research.google.com/github/DJCordhose/ai/blob/master/notebooks/rl/berater-v5.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Berater Environment v5
## Changes from v4
1. encode observation to local one
1. non existing c... | github_jupyter |
<h1><center>Solving Linear Equations with Quantum Circuits</center></h1>
<h2><center>Ax = b</center></h2>
<h4><center> Attempt to replicate the following paper </center></h4>

<h3><center>Algorithm for a simpler 2 x 2 example</center></h3>


import numpy as np
import matplotlib.pyplot as plt
from sk... | github_jupyter |
#Stock Price Predictor
This is a Jupyter notebook that you can use to get prediction of adjusted close stock price per the specified day range after the last day from the training data set. The prediction is made by training the machine learning model with historical trade of the stock data. This is the result of stud... | github_jupyter |
<a href="https://qworld.net" target="_blank" align="left"><img src="../qworld/images/header.jpg" align="left"></a>
$ \newcommand{\bra}[1]{\langle #1|} $
$ \newcommand{\ket}[1]{|#1\rangle} $
$ \newcommand{\braket}[2]{\langle #1|#2\rangle} $
$ \newcommand{\dot}[2]{ #1 \cdot #2} $
$ \newcommand{\biginner}[2]{\left\langle... | github_jupyter |
```
import os
import struct
import pandas as pd
import numpy as np
import talib as tdx
def readTdxLdayFile(fname="data/sh000001.day"):
dataSet=[]
with open(fname,'rb') as fl:
buffer=fl.read() #读取数据到缓存
size=len(buffer)
rowSize=32 #通信达day数据,每32个字节一组数据
code=os.path.basename(fname).replace('.day','')
... | github_jupyter |
```
import argparse
import torch.distributed as dist
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
import test # import test.py to get mAP after each epoch
from models import *
from utils.datasets import *
from utils.utils import *
from mymodel import *
# Hyperparameters (results68: 5... | github_jupyter |
# [Histogram](https://plotly.com/python/histograms/)
## 1. importar las librerías + csv con los datos de la encuesta.
```
# importar librerias
import pandas as pd
import plotly.express as px
from dash import Dash, dcc, html, Input, Output
#crear un dataframe con toda la informacion de la encuesta
df_csv = pd.rea... | github_jupyter |
# How to Build a Personalized Trading Dashboard?
> A personalized dashboard to viusalize trading actions and stock development
- toc: false
- badges: true
- comments: true
- categories: [data analysis, trading, jupternotebook]
```
# hide
from datetime import datetime, timedelta
import altair as alt
import numpy as... | github_jupyter |
# Answer Key to the Data Wrangling with DataFrames Coding Quiz
Helpful resources:
http://spark.apache.org/docs/latest/api/python/pyspark.sql.html
```
from pyspark.sql import SparkSession
from pyspark.sql.functions import isnan, count, when, col, desc, udf, col, sort_array, asc, avg
from pyspark.sql.functions import s... | github_jupyter |
```
#hide
%load_ext autoreload
%autoreload 2
# default_exp analysis
```
# Analysis
> The analysis functions help a modeler quickly run a full time series analysis.
An analysis consists of:
1. Initializing a DGLM, using `define_dglm`.
2. Updating the model coefficients at each time step, using `dglm.update`.
3. Fore... | github_jupyter |
# Support Vector Machines
Support Vector Machines (SVM) are an extension of the linear methods that attempt to separate classes with hyperplans.
These extensions come in three steps:
1. When classes are linearly separable, maximize the margin between the two classes
2. When classes are not linearly separable, maximiz... | github_jupyter |
```
import caffe
import numpy as np
import matplotlib.pyplot as plt
import os
from keras.datasets import mnist
from caffe.proto import caffe_pb2
import google.protobuf.text_format
plt.rcParams['image.cmap'] = 'gray'
%matplotlib inline
```
Loading the model
```
model_def = 'example_caffe_mnist_model.prototxt'
model_we... | github_jupyter |
# Transpose convolution: Upsampling
In section 10.5.3, we discussed how transpose convolutions are can be used to upsample a lower resolution input into a higher resolution output. This notebook contains fully functional PyTorch code for the same.
```
import matplotlib.pyplot as plt
import torch
import math
```
Firs... | github_jupyter |
```
import tensorflow as tf
print(tf.__version__)
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow import keras
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")... | github_jupyter |
```
!pip install -U -q dvc dvc[gdrive]
# !dvc get https://github.com/sparsh-ai/reco-data ml1m/v0/ratings.dat
```
## Dataset
```
RAW_DATASET_ROOT_FOLDER = '/content/data/bronze'
PREP_DATASET_ROOT_FOLDER = '/content/data/silver'
FNL_DATASET_ROOT_FOLDER = '/content/data/gold'
import pickle
import shutil
import tempfile
... | github_jupyter |
# Introduction
refer to this solution :https://www.kaggle.com/jsaguiar/lightgbm-7th-place-solution
https://www.tinymind.cn/articles/3655
https://github.com/Featuretools/Automated-Manual-Comparison/tree/master/Loan%20Repayment
https://www.kaggle.com/willkoehrsen/start-here-a-gentle-introduction/
# Read Data
```
# i... | github_jupyter |
# Genentech Cervical Cancer - Feature Selection
https://www.kaggle.com/c/cervical-cancer-screening/
```
# imports
import sys # for stderr
import numpy as np
import pandas as pd
import sklearn as skl
from sklearn import metrics
import matplotlib.pyplot as plt
%matplotlib inline
# settings
%logstop
%logstart -o 'cc_f... | github_jupyter |
```
import nltk
import difflib
import time
import gc
import itertools
import multiprocessing
import pandas as pd
import numpy as np
import xgboost as xgb
import lightgbm as lgb
import warnings
warnings.filterwarnings('ignore')
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
from sklearn.metri... | github_jupyter |
# Homework 1
The maximum score of this homework is 100+10 points. Grading is listed in this table:
| Grade | Score range |
| --- | --- |
| 5 | 85+ |
| 4 | 70-84 |
| 3 | 55-69 |
| 2 | 40-54 |
| 1 | 0-39 |
Most exercises include tests which should pass if your solution is correct.
However successful test do not guaran... | github_jupyter |
# Optimiztion with `mystic`
```
%matplotlib notebook
```
`mystic`: approximates that `scipy.optimize` interface
```
"""
Example:
- Minimize Rosenbrock's Function with Nelder-Mead.
- Plot of parameter convergence to function minimum.
Demonstrates:
- standard models
- minimal solver interface
- pa... | github_jupyter |
# libraries
```
import sys
import os
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import en_core_web_sm
from spacy.matcher import Matcher
%matplotlib inline
# to import Database class from data_collection folder
module_path = os.path.abspath(os.path.join('../..')+'/dat... | github_jupyter |
```
import pandas as pd
import numpy as np
import biogeme.database as db
import biogeme.biogeme as bio
import biogeme.models as models
import biogeme.messaging as message
from biogeme.expressions import Beta
```
# Intra-zonal trips
## Parameter estimation
Assignment of inner-zonal trips is not possible with common met... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.