repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
JanetMatsen/bacteriopop | depreciated/play_with_pandas_Panels--eventually_delete.ipynb | apache-2.0 | import pandas as pd
"""
Explanation: This is an exploration of the ability to get element-wise averages for Pandas DataFrames.
In our case, we know the row/column combinations do not match across matrices we want to average.
This pd.Panel looked promising: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.P... |
DiracInstitute/kbmod | notebooks/kl_divergence_filter.ipynb | bsd-2-clause | central_source = np.zeros((21, 21))
central_source[10,10] = 1.
gaussian_test = ndimage.gaussian_filter(central_source, 1.4)
imshow(gaussian_test)
colorbar()
"""
Explanation: KL-Divergence Filter
In this notebook we will test out a filter for postage stamps that uses the KL-Divergence to determine how alike the obje... |
phoebe-project/phoebe2-docs | 2.3/tutorials/ecc.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
"""
Explanation: Eccentricity (Volume Conservation)
Setup
Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
import phoebe
from phoebe import u # units
import... |
GoogleCloudPlatform/ml-design-patterns | 06_reproducibility/model_versioning.ipynb | apache-2.0 | import json
import numpy as np
import pandas as pd
import xgboost as xgb
import tensorflow as tf
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from google.cloud import bigquery
"""
Explanation: Model Versioning Design Pattern
In the ... |
jingzhehu/udacity_mlnd | P2_Building_a_Student_Intervention_System/P2_Student_Intervention_System.ipynb | mit | # Import libraries
import numpy as np
import pandas as pd
# Read student data
student_data = pd.read_csv("student-data.csv")
print "Student data read successfully!"
# Note: The last column 'passed' is the target/label, all other are feature columns
"""
Explanation: Project 2: Supervised Learning
Building a Student I... |
tensorflow/hub | examples/colab/yamnet.ipynb | apache-2.0 | #@title Copyright 2020 The TensorFlow Hub Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... |
idc9/law-net | explore/network_nlp/NLPclustering_vs_NetworkCD.ipynb | mit | repo_directory = '/Users/iaincarmichael/Dropbox/Research/law/law-net/'
data_dir = '/Users/iaincarmichael/data/courtlistener/'
import numpy as np
import sys
import matplotlib.pyplot as plt
# graph package
import igraph as ig
# stat
import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
# our c... |
P7h/FutureLearn__Learn_to_Code_for_Data_Analysis | Week#1/Week_1_project.ipynb | apache-2.0 | # Print platform info of Python exec env.
import sys
sys.version
import warnings
warnings.simplefilter('ignore', FutureWarning)
from pandas import *
show_versions()
"""
Explanation: Table of Contents
<p><div class="lev1 toc-item"><a href="#Project-1:-Deaths-by-tuberculosis" data-toc-modified-id="Project-1:-Deaths-by... |
ramseylab/networkscompbio | class21_reveal_python3.ipynb | apache-2.0 | import pandas
import numpy
import itertools
"""
Explanation: Class 21: joint entropy and the REVEAL algorithm
We'll use the bladder cancer gene expression data to test out the REVEAL algorithm. First, we'll load the data and filter to include only genes for which the median log2 expression level is > 12 (as we did in... |
astro4dev/OAD-Data-Science-Toolkit | Teaching Materials/Programming/Python/Python3Espanol/1_Introduccion/02. Variables, tipos y operaciones.ipynb | gpl-3.0 | a=2 # Declaro (defino) el valor de la variable a
a
a+a+a+a+a
a*5
a * 5
a*a
type(a)
b=1.5
type(b)
B=2.5
print(b,B)
c='German '
type(c)
c
c+c+c+c+c
c*5
c*c
1<5
1 < 5
1<0
d=(1<5)
d
d = (1 < 5)
d
type(d)
2*1.2
b*c
a*c
2*False
2*True
2*False
a<b
e=(a<b)
e
a==b # Son iguales?
a=b # Re-defin... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/sdk/sdk_custom_image_classification_online_explain.ipynb | apache-2.0 | import os
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG
"""
Explanation: Vertex SDK: Custom training image classification model for online prediction with explainabilty... |
scotthuang1989/Python-3-Module-of-the-Week | concurrency/asyncio/Executing Tasks Concurrently.ipynb | apache-2.0 | # %load asyncio_create_task.py
import asyncio
async def task_func():
print('in task_func')
return 'the result'
async def main(loop):
print('creating task')
task = loop.create_task(task_func())
print('waiting for {!r}'.format(task))
return_value = await task
print('task completed {!r}'.fo... |
tensorflow/ranking | tensorflow_ranking/examples/handling_sparse_features.ipynb | apache-2.0 | !wget -O "/tmp/vocab.txt" "http://ciir.cs.umass.edu/downloads/Antique/tf-ranking/vocab.txt"
!wget -O "/tmp/train.tfrecords" "http://ciir.cs.umass.edu/downloads/Antique/tf-ranking/ELWC/train.tfrecords"
!wget -O "/tmp/test.tfrecords" "http://ciir.cs.umass.edu/downloads/Antique/tf-ranking//ELWC/test.tfrecords"
"""
Explan... |
tylere/docker-tmpnb-ee | notebooks/1 - IPython Notebook Examples/IPython Project Examples/IPython Kernel/SymPy.ipynb | apache-2.0 | from IPython.display import display
from sympy.interactive import printing
printing.init_printing(use_latex='mathjax')
from __future__ import division
import sympy as sym
from sympy import *
x, y, z = symbols("x y z")
k, m, n = symbols("k m n", integer=True)
f, g, h = map(Function, 'fgh')
"""
Explanation: SymPy: Ope... |
nick-youngblut/SIPSim | ipynb/bac_genome/priming_exp/CD-HIT.ipynb | mit | baseDir = '/home/nick/notebook/SIPSim/dev/priming_exp/'
workDir = os.path.join(baseDir, 'CD-HIT')
rnammerDir = '/home/nick/notebook/SIPSim/dev/bac_genome1210/rnammer/'
otuRepFile = '/var/seq_data/priming_exp/otusn.pick.fasta'
otuTaxFile = '/var/seq_data/priming_exp/otusn_tax/otusn_tax_assignments.txt'
genomeDir = '/ho... |
srcole/qwm | sfn/Poster viewer distribution by SfN theme.ipynb | mit | %config InlineBackend.figure_format = 'retina'
%matplotlib inline
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
from tools.plt import scatt_corr, unpair_2cond, scatt_2cond
import seaborn as sns
sns.set_style('white')
import pandas as pd
"""
Explanation: Poster viewer distribution by SfN them... |
kaushik94/tardis | docs/running/interaction/init_trad_bug.ipynb | bsd-3-clause | pwd
import tardis
import numpy as np
"""
Explanation: Initial_t_rad Bug
The purpose of this notebook is to demonstrate the bug associated with setting the initial_t_rad tardis.plasma property.
End of explanation
"""
density_dat = np.loadtxt('data/density.txt',skiprows=1)
abund_dat = np.loadtxt('data/abund.dat', ski... |
coolharsh55/advent-of-code | 2016/python3/Day15.ipynb | mit | class Disc:
def __init__(self, total_positions, starting_position):
self._total_positions = total_positions
self.current_position = starting_position
@property
def total_positions(self):
return self._total_positions
def __repr__(self):
return 'total: {} current:... |
AtmaMani/pyChakras | ml/sklearn_naive_bayes_classifier.ipynb | mit | import seaborn as sns
iris = sns.load_dataset('iris')
iris.head()
iris.shape
iris['species'].value_counts().plot(kind='bar')
%matplotlib inline
sns.pairplot(iris, hue='species')
"""
Explanation: Naive Bayes classification - Sklearn
Naive Bayes classifier builds directly on conditional probability and this
$$
p(y|x... |
chinapnr/python_study | Python 基础课程/Python Basic Lesson 08 - 函数.ipynb | gpl-3.0 | # 计算圆的面积
# 不用函数的话,每次需要写一些重复的代码
r1 = 4
r2 = 6
r3 = 5.61
s1 = 3.14 * r1 * r1
s2 = 3.14 * r2 * r2
s3 = 3.14 * r3 * r3
print(s1)
print(s2)
print(s3)
# 定义一个函数,用来计算圆面积
# 输入 半径,返回 圆面积
def func1(r):
s = 3.14 * r * r
return s
print(func1(4))
print(func1(6))
print(func1(5.61))
# 先来看看 python 内置的获取最大值的函数
print(max(1... |
AllenDowney/ThinkBayes2 | soln/mango_soln.ipynb | mit | # If we're running on Colab, install empiricaldist
# https://pypi.org/project/empiricaldist/
import sys
IN_COLAB = 'google.colab' in sys.modules
if IN_COLAB:
!pip install empiricaldist
# Get utils.py and create directories
import os
if not os.path.exists('utils.py'):
!wget https://github.com/AllenDowney/Th... |
whitead/numerical_stats | unit_18/lectures/lecture_1.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
import statsmodels.api as sm
import scipy.stats as ss
import numpy.linalg as linalg
x1 = [1, 1, -1, -1]
x2 = [1, -1, 1, -1]
y = [1.2, 3.2, 4.1, 3.6]
"""
Explanation: Design of Experiments
Unit 18, Lecture 1
Numerical Methods and Statistics
Prof. Andrew White, April ... |
MaximMalakhov/coursera | Finding a structure in the data/Week 4/edit_CookingLDA_PA.ipynb | mit | import json
with open("recipes.json") as f:
recipes = json.load(f)
print recipes[0]
"""
Explanation: Programming Assignment:
Готовим LDA по рецептам
Как вы уже знаете, в тематическом моделировании делается предположение о том, что для определения тематики порядок слов в документе не важен; об этом гласит гипотез... |
QuantStack/quantstack-talks | 2018-06-18-IFPEN-Tech/notebooks/03 - Custom.ipynb | bsd-3-clause | import ipywidgets as widgets
from traitlets import Unicode
class HelloWidget(widgets.DOMWidget):
_view_name = Unicode('HelloView').tag(sync=True)
_view_module = Unicode('hello').tag(sync=True)
"""
Explanation: Custom Jupyter Widgets
The Hello World Example of the Cookie Cutter
The widget framework is built ... |
JamesSample/icpw | toc_trends_oct_2016_part3.ipynb | mit | # Read data
in_csv = (r'C:\Data\James_Work\Staff\Heleen_d_W\ICP_Waters\TOC_Trends_Analysis_2015'
r'\Results\toc_trends_long_format.csv')
df = pd.read_csv(in_csv, encoding='utf-8')
# Remove TOC at site 23467
df = df.query('not((station_id==23467) and (par_id=="TOC"))')
# Remove sulphate-related series at sit... |
vladan-jovicic/ComplexNetworks | Notebooks/Assignment2.ipynb | mit | import os, sys, math
import collections as collcs
# append the path so that modules can be properly imported
sys.path.append('../src/')
import graph
import algorithms.erdos_renyi as er
import algorithms.newman_model as nm
reload(graph)
reload(er)
reload(nm)
# generate a random graph having 1000 vertices
n, p, seed =... |
AllenDowney/CompStats | effect_size_soln.ipynb | mit | from __future__ import print_function, division
import numpy
import scipy.stats
import matplotlib.pyplot as pyplot
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
# seed the random number generator so we all get the same results
numpy.random.seed(17)
# some nice colors from http://... |
mbeyeler/opencv-machine-learning | notebooks/02.02-Loading-External-Datasets-in-Python.ipynb | mit | from sklearn import datasets
mnist = datasets.fetch_mldata('MNIST original')
"""
Explanation: <!--BOOK_INFORMATION-->
<a href="https://www.packtpub.com/big-data-and-business-intelligence/machine-learning-opencv" target="_blank"><img align="left" src="data/cover.jpg" style="width: 76px; height: 100px; background: whit... |
AkshanshChahal/BTP | Satellite/Lat_Lon_Pixel.ipynb | mit | from osgeo import ogr, osr, gdal
# opening the geotiff file
ds = gdal.Open('G:\BTP\Satellite\Data\Test2\LE07_L1GT_147040_20050506_20170116_01_T2\LE07_L1GT_147040_20050506_20170116_01_T2_B1.TIF')
col, row, band = ds.RasterXSize, ds.RasterYSize, ds.RasterCount
print(col, row, band)
xoff, a, b, yoff, d, e = ds.GetGeoTr... |
m2dsupsdlclass/lectures-labs | labs/06_deep_nlp/Transformers_Joint_Intent_Classification_Slot_Filling_rendered.ipynb | mit | import tensorflow as tf
tf.__version__
!nvidia-smi
# TODO: update this notebook to work with the latest version of transformers
%pip install -q transformers==2.11.0
"""
Explanation: Joint Intent Classification and Slot Filling with Transformers
The goal of this notebook is to fine-tune a pretrained transformer-based... |
sujitpal/polydlot | src/tf-serving/03b-consume-model.ipynb | apache-2.0 | from __future__ import division, print_function
from google.protobuf import json_format
from grpc.beta import implementations
from sklearn.preprocessing import OneHotEncoder
from tensorflow_serving.apis import predict_pb2
from tensorflow_serving.apis import prediction_service_pb2
from sklearn.metrics import accuracy_sc... |
borja876/Thinkful-DataScience-Borja | Drill Central Limit Theorem.ipynb | mit | #Change the population value for pop1 to 0.3
pop1 = np.random.binomial(10, 0.3, 10000)
pop2 = np.random.binomial(10,0.5, 10000)
plt.hist(pop1, alpha=0.5, label='Population 1')
plt.hist(pop2, alpha=0.5, label='Population 2')
plt.legend(loc='upper right')
plt.show()
print(pop1.mean())
print(pop2.mean())
print(pop1.... |
DestrinStorm/deep-learning | batch-norm/Batch_Normalization_Lesson.ipynb | mit | # Import necessary packages
import tensorflow as tf
import tqdm
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# Import MNIST data so we have something for our experiments
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
"... |
jart/tensorflow | tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb | apache-2.0 | from __future__ import absolute_import, division, print_function
# Import TensorFlow >= 1.9 and enable eager execution
import tensorflow as tf
tf.enable_eager_execution()
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import unicodedata
import re
import numpy as np
import os
im... |
mne-tools/mne-tools.github.io | 0.16/_downloads/plot_sensors_time_frequency.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.time_frequency import tfr_morlet, psd_multitaper
from mne.datasets import somato
"""
Explanation: Frequency and time-frequency sensors analysis
The objective is to show you how to explore the spectral content
of your data (frequency and time-frequ... |
robertoalotufo/ia898 | master/dftmatrixexamples.ipynb | mit | import sys,os
%matplotlib inline
ia898path = os.path.abspath('/etc/jupyterhub/ia898_1s2017/')
if ia898path not in sys.path:
sys.path.append(ia898path)
import ia898.src as ia
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from numpy.fft import fft2
from numpy.fft import ifft2
""... |
bflaven/BlogArticlesExamples | stop_starting_start_stopping/pandas_convert_json/.ipynb_checkpoints/pandas-convert-json-checkpoint.ipynb | mit | import pandas as pd
"""
Explanation: Pandas convert JSON into a DataFrame
This is a notebook for the medium article How to convert JSON into a Pandas DataFrame?
Please check out article for instructions
License: BSD 2-Clause
End of explanation
"""
df = pd.read_json('data/simple.json')
df
df.info()
"""
Explanation:... |
kwinkunks/axb | NumPy_wavelets_no_noise.ipynb | apache-2.0 | import sys
sys.version
import numpy as np
np.__version__
import sklearn
sklearn.__version__
"""
Explanation: Linear inverse solutions in NumPy
An exploration of linear seismic inversion — considering the particular problem of getting reflectivity from a seismic trace, given the wavelet.
We'll be working on a model, ... |
SJSlavin/phys202-2015-work | assignments/assignment05/InteractEx03.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 3
Imports
End of explanation
"""
def soliton(x, t, c, a):
"""Return phi(x, t) for a soliton wave with co... |
Elixeus/NLP | InfoRetri/VectorSpacePractice.ipynb | mit | # create a collection matrix (using the count vectorizer)
countVectorizer = CountVectorizer()
# The CountVectorizer will return a document-term sparse matrix
# the rows represent the documents, and the columns represent terms
# since we have only 2 documents, I use 2 variables to represent the 2 vectors returned
d1_cou... |
bashtage/statsmodels | examples/notebooks/theta-model.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pandas_datareader as pdr
import seaborn as sns
plt.rc("figure", figsize=(16, 8))
plt.rc("font", size=15)
plt.rc("lines", linewidth=3)
sns.set_style("darkgrid")
"""
Explanation: The Theta Model
The Theta model of Assimakopoulos & Nikolopoulo... |
dsavransky/miscpy | Notebooks/Rotary_Pendulum.ipynb | mit | from sympyhelpers import *
init_printing()
"""
Explanation: Preamble Stuff (ignore)
End of explanation
"""
th,psi,thd,psid,R,g,t,l,thdd,phdd,psidd,N1,N2,N3,mr,tau,J = \
symbols('theta,psi,thetadot,psidot,R,g,t,l,thetaddot,phiddot,psiddot,N_1,N_2,N_3,m_r,tau,J')
diffdict = {th:thd,thd:thdd,psi:psid,psid:psidd}
"""
... |
Featuretools/featuretools | docs/source/guides/tuning_dfs.ipynb | bsd-3-clause | import featuretools as ft
es = ft.demo.load_mock_customer(return_entityset=True)
es
"""
Explanation: Tuning Deep Feature Synthesis
There are several parameters that can be tuned to change the output of DFS. We'll explore these parameters using the following transactions EntitySet.
End of explanation
"""
expensive_pu... |
daniestevez/jupyter_notebooks | dslwp/telemetry/Telemetry CSV.ipynb | gpl-3.0 | TMPrimaryHeader = BitStruct('transfer_frame_version_number' / BitsInteger(2),
'spacecraft_id' / BitsInteger(10),
'virtual_channel_id' / BitsInteger(3),
'ocf_flag' / Flag,
'master_channel_frame_count' / BitsIn... |
phanrahan/magmathon | notebooks/tutorial/icestick/Register.ipynb | mit | import magma as m
m.set_mantle_target("ice40")
"""
Explanation: DFFs and Registers
This example demonstrates the use of d-flip-flops and registers.
End of explanation
"""
from loam.boards.icestick import IceStick
from mantle import DFF
icestick = IceStick()
icestick.Clock.on() # Need to turn on the clock for sequen... |
shikhar413/openmc | examples/jupyter/mg-mode-part-i.ipynb | mit | import os
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import numpy as np
import openmc
%matplotlib inline
"""
Explanation: Multigroup Mode Part I: Introduction
This Notebook illustrates the usage of OpenMC's multi-group calculational mode with the Python API. This example notebook creates and... |
FeitengLab/EmotionMap | 4USCityEmotion/create_database.ipynb | mit | import psycopg2
"""
Explanation: API
End of explanation
"""
class CloudDatabase(object):
# Init database and input ip
# 初始化数据库并传入ip
def __init__(self, database, user, password, ip="127.0.0.1", port="5432"):
self.database = database
self.user = user
self.password = password
... |
KECB/learn | BAMM.101x/Networks.ipynb | mit | import networkx as nx
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
simple_network = nx.Graph()
nodes = [1,2,3,4,5,6,7,8]
edges = [(1,2),(2,3),(1,3),(4,5),(2,7),(1,9),(3,4),(4,5),(4,9),(5,6),(7,8),(8,9)]
simple_network.add_nodes_from(nodes)
simple_network.add_edges_from(edges)
nx.draw(simple_ne... |
qutip/qutip-notebooks | examples/measures-trajectories-cats-kerr.ipynb | lgpl-3.0 | import matplotlib.pyplot as plt
import numpy as np
from qutip import *
from IPython.display import display, Math, Latex
"""
Explanation: Cat vs coherent states in a Kerr resonator, and the role of measurement
$\newcommand{\ket}[1]{| #1 \rangle}$
$\newcommand{\bra}[1]{\langle #1 |}$
$\newcommand{\braket}[1]{\langle #1 ... |
tensorflow/docs-l10n | site/pt-br/tutorials/quickstart/advanced.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/gapic/automl/showcase_automl_text_multi-label_classification_batch.ipynb | apache-2.0 | import os
import sys
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install -U google-cloud-aiplatform $USER_FLAG
"""
Explanation: Vertex client library: AutoML text multi-label classification model for batch prediction
<t... |
dedx/STAR2015 | notebooks/Battleship.ipynb | mit | from random import randint
from ipythonblocks import BlockGrid
from IPython.display import clear_output
def place_ship(boardsize):
'''
Place a ship randomly on the board
of size boardsize x boardsize.
Randomly decide whether it is vertical
or horizontal, what length ship, the
placement of th... |
maurodoglio/taar | analysis/TAARExperimentV2Retention-alternate.ipynb | mpl-2.0 | S3_PATH = "s3://net-mozaws-prod-us-west-2-pipeline-analysis/taarv2/cleaned_data/"
# Select essential columns.
clean_data = sqlContext.read.parquet(S3_PATH).select('client_id', 'locale', 'branch', 'submission_date_s3')
# Display number of rows per branch.
clean_data.groupBy('branch').count().collect()
"""
Explanation:... |
statsmodels/statsmodels.github.io | v0.12.2/examples/notebooks/generated/quasibinomial.ipynb | bsd-3-clause | import statsmodels.api as sm
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from io import StringIO
"""
Explanation: Quasi-binomial regression
This notebook demonstrates using custom variance functions and non-binary data
with the quasi-binomial GLM family to perform a regression analysis using... |
junhwanjang/DataSchool | Lecture/18. 문서 전처리/1) Python 문자열 인코딩.ipynb | mit | c = "a"
c
print(c)
x = "가"
x
print(x)
print(x.__repr__())
x = ["가"]
print(x)
x = "가"
len(x)
x = "ABC"
y = "가나다"
print(len(x), len(y))
print(x[0], x[1], x[2])
print(y[0], y[1], y[2])
print(y[0], y[1], y[2], y[3])
"""
Explanation: Python 문자열 인코딩
문자와 인코딩
문자의 구성
바이트 열 Byte Sequence: 컴퓨터에 저장되는 자료. 각 글자에 바이트 열을 지정
글... |
mohanprasath/Course-Work | coursera/data_visualization_with_python/DV0101EN-3-5-1-Generating-Maps-in-Python-py-v2.0.ipynb | gpl-3.0 | import numpy as np # useful for many scientific computing in Python
import pandas as pd # primary data structure library
"""
Explanation: <a href="https://cognitiveclass.ai"><img src = "https://ibm.box.com/shared/static/9gegpsmnsoo25ikkbl4qzlvlyjbgxs5x.png" width = 400> </a>
<h1 align=center><font size = 5>Generating... |
ivannz/study_notes | year_14_15/spring_2015/netwrok_analysis/notebooks/assignments/networks_ha4.ipynb | mit | import numpy as np
import networkx as nx
from matplotlib import pyplot as plt
%matplotlib inline
from scipy.io import loadmat
import warnings
warnings.filterwarnings( 'ignore' )
"""
Explanation: <center>Structural Analysis and Visualization of Networks</center>
<center>Home Assignment #4: Community Detection Algorithm... |
tensorflow/docs-l10n | site/ja/addons/tutorials/average_optimizers_callback.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
jjehl/poppy_education | python-divers/tutorial_rotation_matrix.ipynb | gpl-2.0 | import numpy as np
from math import *
"""
Explanation: Les matrices de rotations permettent de calculer des mouvements dans l'espace en changeant de référentiel. Pour cela, on effectue une rotation centrée sur l'origine de notre repère.
Voyons un exemple :
J'ai le vecteur A, x=5 et y=3. Je fais effectuer une rotation ... |
davidzchen/tensorflow | tensorflow/python/ops/numpy_ops/g3doc/TensorFlow_Numpy_Distributed_Image_Classification.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
mne-tools/mne-tools.github.io | 0.19/_downloads/f5f9bdd06f90122e3e9f099984de196a/plot_evoked_topomap.ipynb | bsd-3-clause | # Authors: Christian Brodbeck <christianbrodbeck@nyu.edu>
# Tal Linzen <linzen@nyu.edu>
# Denis A. Engeman <denis.engemann@gmail.com>
# Mikołaj Magnuski <mmagnuski@swps.edu.pl>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
from mne.datasets import sample
from... |
radaniba/QuotaWatcher | QuotaWatcher.ipynb | gpl-2.0 | from __future__ import division
__author__ = "Rad <aradwen@gmail.com>"
__license__ = "GNU General Public License version 3"
__date__ = "06/30/2015"
__version__ = "0.2"
try:
import os
from quota_logger import init_log
import subprocess
from prettytable import PrettyTable
from smtplib import SMTP
... |
peishunli/peishunli.github.io | blog/python_beginning/.ipynb_checkpoints/5object-checkpoint.ipynb | gpl-3.0 | 'abc'.count('a')
[1,2,'a'].count('a')
"""
Explanation: title: 对象
create: 2016.12.7
modified: 2016.12.7
tags: python
多态
封装
方法
5
[TOC]
之前介绍了Python主要的内建对象类型(数字int、字符串str、列表list、元组tuple和字典dict),以及内建函数和标准库的用法,还有自定义函数的方式。接下来将介绍如何创建自己的对象?
为什么要自定义对象呢?使用字典、序列、数字和字符串来创建函数,完成这项工作还不够吗?这样做当然可以,但是创建自己的对象... |
leezu/mxnet | example/multi-task/multi-task-learning.ipynb | apache-2.0 | import logging
import random
import time
import matplotlib.pyplot as plt
import mxnet as mx
from mxnet import gluon, nd, autograd
import numpy as np
"""
Explanation: Multi-Task Learning Example
This is a simple example to show how to use mxnet for multi-task learning.
The network is jointly going to learn whether a n... |
jrrembert/cybernetic-organism | dato/recommendations/.ipynb_checkpoints/Song recommender-checkpoint.ipynb | gpl-2.0 | import graphlab
"""
Explanation: Building a song recommender
Fire up GraphLab Create
End of explanation
"""
song_data = graphlab.SFrame('song_data.gl/')
"""
Explanation: Load music data
End of explanation
"""
song_data.head()
"""
Explanation: Explore data
Music data shows how many times a user listened to a song... |
machow/siuba | examples/architecture/007-how-pandas-groupby-works.ipynb | mit | from siuba.data import mtcars
g_cyl = mtcars.groupby('cyl')
# works
mtcars.hp.corr(mtcars.mpg)
# doesn't work
# g_cyl.hp.corr(g_cyl.mpg)
"""
Explanation: Groupby Architecture
Problem
Pandas has a well-designed groupby architecture, but when developing against it I often hit three challenges:
It involves 4 to 5 cla... |
ML4DS/ML4all | NLP1.CorpusAcquisition/NSF_CorpusAcq_students.ipynb | mit | # Common imports
import numpy as np
import pandas as pd
import zipfile as zp
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
"""
Explanation: Corpus Acquisition: National Science Foundation data
Date: Mar 08, 2021
Author: Jerónimo Arenas-Garcí... |
nitlev/deepforest | notebooks/deepforest.ipynb | mit | import pkg_resources
raw_data = pd.read_csv(pkg_resources.resource_stream('deepforest', 'data/train.csv'))
clean_data = raw_data.drop(["Cabin", "Name", "PassengerId", "Ticket"], axis=1)
clean_data = pd.get_dummies(clean_data).fillna(-1)
train, test = train_test_split(clean_data)
def split_x_y(dataframe, target):
... |
ryneches/SuchTree | docs/old_notebooks/example_2.ipynb | bsd-3-clause | from ete2 import Tree, TreeStyle, NodeStyle, TextFace
from numpy import linspace
ts = TreeStyle()
ts.mode = 'r'
ts.show_leaf_name = True
ts.branch_vertical_margin = 2
ts.scale = 1000
ts.show_leaf_name = False
ts.show_scale = False
nstyle = NodeStyle()
nstyle['size'] = 0
ete_tree = Tree( '../fishpoo/mcgee_trimmed.tre... |
rayjustinhuang/DataAnalysisandMachineLearning | Adult Dataset - Income Prediction.ipynb | mit | import urllib.request
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
desc = urllib.request.urlopen("http://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.names").read(20000).decode('utf=8')
print(desc)
"""
Explanation: Adult Dataset
Thi... |
eemos1/end_of_day_2_defense_programming | DefensiveProgramming_3.ipynb | mit | def test_range_overlap():
assert range_overlap([(-3.0, 5.0), (0.0, 4.5), (-1.5, 2.0)]) == (0.0, 2.0)
assert range_overlap([ (2.0, 3.0), (2.0, 4.0) ]) == (2.0, 3.0)
assert range_overlap([ (0.0, 1.0), (0.0, 2.0), (-1.0, 1.0) ]) == (0.0, 1.0)
"""
Explanation: # Defensive programming (2)
We have seen the ba... |
feststelltaste/software-analytics | courses/20190918_Uni_Leipzig/Parsing and Analysing vmstat Data the Hard Way (Demo Notebook).ipynb | gpl-3.0 | %less ../datasets/vmstat_loadtest.log
"""
Explanation: This notebook shows you step by step how you can transform text data from vmstat output file into a pandas DataFrame.
End of explanation
"""
import pandas as pd
raw = pd.read_csv("../datasets/vmstat_loadtest.log", skiprows=1)
raw.head()
columns = raw.columns.s... |
xiaoxiaoyao/MyApp | jupyter_notebook/SQL-Injection-Attack.ipynb | unlicense | import sqlite3
# 连接数据库
conn = sqlite3.connect('SQL-Injection-Attack.db')
# 建立新的数据表
conn.executescript('''DROP TABLE IF EXISTS students;
CREATE TABLE students
(id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT(99) NOT NULL);''')
# 插入学生信息
students = ['Paul','Tom','Tracy','Lily']
for name in student... |
mne-tools/mne-tools.github.io | 0.16/_downloads/plot_stats_cluster_spatio_temporal.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Eric Larson <larson.eric.d@gmail.com>
# License: BSD (3-clause)
import os.path as op
import numpy as np
from numpy.random import randn
from scipy import stats as stats
import mne
from mne.epochs import equalize_epoch_counts
from mne.... |
mne-tools/mne-tools.github.io | 0.16/_downloads/plot_decoding_spatio_temporal_source.ipynb | bsd-3-clause | # Author: Denis A. Engemann <denis.engemann@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Jean-Remi King <jeanremi.king@gmail.com>
#
# License: BSD (3-clause)
import os
import numpy as np
import matplotlib.pyplot as plt
from sklearn.pipeline import make_pipeline
from sklear... |
lehnertu/TEUFEL | scripts/TestCase_DiffractionScreen.ipynb | gpl-3.0 | import numpy as np
from scipy import constants
import scipy.integrate
import scipy.special as func
from MeshedFields import *
"""
Explanation: If not yet available some libraries and their python bindings have to be installed :<br>
- gmsh (best installed globally through package management system)
- python3 -m pip ins... |
aki-nishimura/probabilistic-matrix-factorization | README.ipynb | mit | import numpy as np
import math
import matplotlib.pyplot as plt
import scipy.sparse as sparse
%matplotlib inline
"""
Explanation: Bayesian Importance Weighted Probabilistic Matrix Factorization
This python module implements a class 'MatrixFactorization' which carries out Bayesian inference for Probabilistic Matrix Fac... |
gcgruen/homework | foundations-homework/05/homework-05-gruen-spotify_graded.ipynb | mit | import requests
lil_response = requests.get ('https://api.spotify.com/v1/search?query=Lil&type=artist&country=US&limit=50')
lil_data = lil_response.json()
print(type(lil_data))
lil_data.keys()
lil_data['artists'].keys()
lil_artists = lil_data['artists']['items']
#check on what elements are in that list:
#print (lil_... |
vicente-gonzalez-ruiz/YAPT | 02-basics/12-generators.ipynb | cc0-1.0 | def yrange(max_i):
i = 0
while i < max_i:
yield i # A special return that continues with the next() call.
i += 1 # next() continues here.
for i in yrange(10):
print(i, end=' ')
# https://es.wikipedia.org/wiki/Sucesi%C3%B3n_de_Fibonacci
# https://www.mathsisfun.com/numbers/fibonacci-sequ... |
quole/gensim | docs/notebooks/doc2vec-wikipedia.ipynb | lgpl-2.1 | from gensim.corpora.wikicorpus import WikiCorpus
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
from pprint import pprint
import multiprocessing
"""
Explanation: Doc2Vec to wikipedia articles
We conduct the replication to Document Embedding with Paragraph Vectors (http://arxiv.org/abs/1507.07998).
In this p... |
ageron/tensorflow-safari-course | 04_linear_regression_ex4.ipynb | apache-2.0 | from __future__ import absolute_import, division, print_function, unicode_literals
import tensorflow as tf
tf.__version__
"""
Explanation: Try not to peek at the solutions when you go through the exercises. ;-)
First let's make sure this notebook works well in both Python 2 and Python 3:
End of explanation
"""
impo... |
phoebe-project/phoebe2-docs | 2.3/tutorials/plotting.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
"""
Explanation: Plotting
This tutorial explains the high-level interface to plotting provided by the Bundle. You are of course always welcome to access arrays and plot manually.
PHOEBE 2.3 uses autofig 1.2 as an intermediate layer for highend functionality to matplotlib.
Setup
Let... |
ES-DOC/esdoc-jupyterhub | notebooks/dwd/cmip6/models/sandbox-3/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'dwd', 'sandbox-3', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: DWD
Source ID: SANDBOX-3
Topic: Ocnbgchem
Sub-Topics: Tracers.
Properties: 6... |
ClaudiaEsp/inet | Analysis/misc/Counting CA3 synapses.ipynb | gpl-2.0 | from __future__ import division
from terminaltables import AsciiTable
import inet
inet.__version__
from inet import DataLoader
"""
Explanation: <H1>Counting CA3 synapses</H1>
<P> We will count synapses and motifs in the CA3 network</P>
End of explanation
"""
mydataset = DataLoader('../data/CA3/') # 1102 experiment... |
sandiegodata/age-friendly-communities | users/rashmi/Age Friendly Communities (AFC) Data Explorer.ipynb | mit | import os
import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import pylab, mlab, gridspec
from IPython.core.pylabtools import figsize, getfigs
from IPython.display import display, HTML
from pylab import *
# GLOBALS
# working directory
CWD = os.getcwd()
# Data File(s)
VE... |
ktmud/deep-learning | gan_mnist/Intro_to_GANs_Exercises.ipynb | mit | %matplotlib inline
import pickle as pkl
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data')
"""
Explanation: Generative Adversarial Network
In this notebook, we'll be building a generativ... |
RaspberryJamBe/ipython-notebooks | notebooks/nl-be/103 - MuziekBox - Reageren op de Raspberry Pi GPIO pins.ipynb | cc0-1.0 | import pygame.mixer
pygame.mixer.init()
"""
Explanation: Reageren op de Raspberry Pi GPIO pins
Met deze IPython Notebook verbinden we hardware met software. We zullen een knop verbinden met de General Purpose Input/Output (GPIO) pinnen* op de Raspberry Pi en wanneer de knop ingedrukt wordt, de Pi een functie laten uit... |
JaviMerino/lisa | ipynb/examples/trace_analysis/TraceAnalysis_FunctionsProfiling.ipynb | apache-2.0 | import logging
reload(logging)
logging.basicConfig(
format='%(asctime)-9s %(levelname)-8s: %(message)s',
datefmt='%I:%M:%S')
# Enable logging at INFO level
logging.getLogger().setLevel(logging.INFO)
# Generate plots inline
%matplotlib inline
import json
import os
# Support to access the remote target
import... |
ilivans/information-retrieval | 04_latent_semantic_clustering/svd_clustering.ipynb | mit | %%time
T, S, Dt = np.linalg.svd(tf_matrix, full_matrices=False)
"""
Explanation: Не нашёл библиотеки, которая позволяла бы делать разложение на 1000 сингулярных чисел (>403). Есть имплементации с параметром full_matrices, но для них не хватает оперативной памяти. Поэтому делаю разложение на размер наименьшей оси (кол-... |
statsmodels/statsmodels.github.io | v0.13.1/examples/notebooks/generated/glm.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import statsmodels.api as sm
from scipy import stats
from matplotlib import pyplot as plt
plt.rc("figure", figsize=(16,8))
plt.rc("font", size=14)
"""
Explanation: Generalized Linear Models
End of explanation
"""
print(sm.datasets.star98.NOTE)
"""
Explanation: GLM: Binomial r... |
jrieke/machine-intelligence-2 | sheet02/2 - PCA.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from pandas.tools.plotting import scatter_matrix
from mpl_toolkits.mplot3d import Axes3D
%matplotlib inline
"""
Explanation: Machine Intelligence II (week 2) -- Team MensaNord
Nikolai Zaki
Alexander Moore
Johannes Rieke
Georg Hoe... |
Hugovdberg/timml | notebooks/timml_notebook6_sol.ipynb | mit | %matplotlib inline
from timml import *
from pylab import *
ml = ModelMaq(kaq=10, z=[10, 0])
rf = Constant(ml, xr=-1000, yr=0, hr=41)
uf = Uflow(ml, slope=0.001, angle=0)
ml.solve()
ml.contour(win=[-1200, 200, -500, 500], ngr=50,
levels=10, labels=True, decimals=2, legend=True, figsize=(8, 8))
"""
Expla... |
adityaka/misc_scripts | python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/00_04/Final/Creating Series.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
"""
Explanation: Series
Series is a one-dimensional labeled array capable of holding any data type (integers, strings, floating point numbers,
Python objects, etc.). The axis labels are collectively referred to as the index.
documentation: http://pandas.pydata.org/pandas-docs/sta... |
semio/ddf_utils | notebook/Chef API.ipynb | mit | import os
import sys
import ruamel.yaml as yaml
from ddf_utils.chef.api import Chef
# at the beginning, initial the chef
chef = Chef()
# adding configs and metadata(to the info section)
(chef.add_config(ddf_dir=os.path.expanduser('~/src/work/Gapminder/datasets'))
.add_metadata(id='test_dataset',
... |
SHDShim/pytheos | examples/8_pv_eos_fit_multi-scales.ipynb | apache-2.0 | %config InlineBackend.figure_format = 'retina'
"""
Explanation: For high dpi displays.
End of explanation
"""
import numpy as np
from uncertainties import unumpy as unp
import pandas as pd
import pytheos as eos
"""
Explanation: 0. General note
This notebook shows an example of EOS fitting for static compression,... |
Danghor/Algorithms | Python/Chapter-04/Insertion-Sort.ipynb | gpl-2.0 | def sort(L):
if L == []:
return []
x, *R = L
return insert(x, sort(R))
"""
Explanation: Insertion Sort
The function sort is specified via two equations:
$\mathtt{sort}([]) = []$
$\mathtt{sort}\bigl([x] + R\bigr) =
\mathtt{insert}\bigl(x, \mathtt{sort}(R)\bigr)$
This is most easily implemen... |
astro4dev/OAD-Data-Science-Toolkit | Teaching Materials/Programming/Python/PythonISYA2018/04.Astropy/01_constants_units.ipynb | gpl-3.0 | from astropy import units as u # This imports the new class
import numpy as np
d = 4.0 * u.parsec
print(d)
type(d)
"""
Explanation: Units and constants
Despite being conceptually simple, changing units can become a tedious task. Specially when complex algebraic expressions appear. Fortunately, astropy has the un... |
lrayle/rental-listings-census | src/data_preprocessing.ipynb | bsd-3-clause | import pandas as pd
import psycopg2
import paramiko
import os
import numpy as np
import json
import zipfile
"""
Explanation: Merge craiglist data with synthetic census data
Steps:
Get craigslist data
Query from remote database in batches based on FIPS
Joing to census via FIPS code
Get census data
Aggregate to BG
M... |
ML4DS/ML4all | R2.kNN_Regression/.ipynb_checkpoints/regression_knn_student-checkpoint.ipynb | mit | # Import some libraries that will be necessary for working with data and displaying plots
# To visualize plots in the notebook
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pylab
# Packages used to read datasets
import scipy.io # To read matlab files
import pan... |
robertoalotufo/ia898 | master/otsudemo.ipynb | mit | f=mpimg.imread('../../lotufo/ia898/data/woodlog.tif')
ia.adshow(f)
H = ia.histogram(f)
x = np.arange(len(H))
k = x[0:-1]
plt.plot(x, H)
"""
Explanation: Image read and histograming
Gray scale image and its histogram
End of explanation
"""
h = 1.*H/np.product(f.shape)
print(sum(h))
mt = sum(x * h)
st2 = sum((x-mt)**2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.