repo_name stringlengths 7 92 | path stringlengths 5 149 | copies stringlengths 1 3 | size stringlengths 4 6 | content stringlengths 911 693k | license stringclasses 15
values |
|---|---|---|---|---|---|
jpmpentwater/cvxpy | examples/expr_trees/1D_convolution.py | 12 | 1453 | #!/usr/bin/env python
from cvxpy import *
import numpy as np
import random
from math import pi, sqrt, exp
def gauss(n=11,sigma=1):
r = range(-int(n/2),int(n/2)+1)
return [1 / (sigma * sqrt(2*pi)) * exp(-float(x)**2/(2*sigma**2)) for x in r]
np.random.seed(5)
random.seed(5)
DENSITY = 0.008
n = 1000
x = Varia... | gpl-3.0 |
shyamalschandra/scikit-learn | examples/decomposition/plot_image_denoising.py | 181 | 5819 | """
=========================================
Image denoising using dictionary learning
=========================================
An example comparing the effect of reconstructing noisy fragments
of the Lena image using firstly online :ref:`DictionaryLearning` and
various transform methods.
The dictionary is fitted o... | bsd-3-clause |
huggingface/pytorch-transformers | src/transformers/utils/versions.py | 1 | 4611 | # Copyright 2020 The HuggingFace Team. 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 by applicabl... | apache-2.0 |
shangwuhencc/scikit-learn | examples/applications/face_recognition.py | 191 | 5513 | """
===================================================
Faces recognition example using eigenfaces and SVMs
===================================================
The dataset used in this example is a preprocessed excerpt of the
"Labeled Faces in the Wild", aka LFW_:
http://vis-www.cs.umass.edu/lfw/lfw-funneled.tgz (2... | bsd-3-clause |
d-mittal/pystruct | pystruct/models/latent_graph_crf.py | 3 | 8415 | import numbers
import numpy as np
from scipy import sparse
from sklearn.cluster import KMeans
from . import GraphCRF
from ..inference import inference_dispatch
def kmeans_init(X, Y, all_edges, n_labels, n_states_per_label,
symmetric=True):
all_feats = []
# iterate over samples
for x, y,... | bsd-2-clause |
ABoothInTheWild/baseball-research | NBA/NBA_17/nba2017SeasonResults.py | 1 | 2218 | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 07 14:28:16 2018
@author: Alexander
"""
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 27 15:01:09 2018
@author: abooth
"""
from xmlstats import xmlstats
import numpy as np
import pandas as pd
access_token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... | gpl-3.0 |
latticelabs/Mitty | setup.py | 1 | 2920 | from setuptools import setup, find_packages
__version__ = eval(open('mitty/version.py').read().split('=')[1])
setup(
name='mitty',
version=__version__,
description='Simulator for genomic data',
author='Seven Bridges Genomics',
author_email='kaushik.ghose@sbgenomics.com',
packages=find_packages(... | gpl-2.0 |
justinfinkle/pydiffexp | scripts/osmo_yeast_prep.py | 1 | 2736 | import sys
import warnings
import numpy as np
import pandas as pd
def parse_title(title, split_str=" "):
"""
Parse the title of GSE13100 into usable metadata. Should work with pandas apply()
Args:
title:
split_str:
Returns:
"""
split = title.split(split_str)
meta = []
... | gpl-3.0 |
Tong-Chen/scikit-learn | sklearn/manifold/tests/test_isomap.py | 31 | 3991 | from itertools import product
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from sklearn import datasets
from sklearn import manifold
from sklearn import neighbors
from sklearn import pipeline
from sklearn import preprocessing
from sklearn.utils.testing import assert_less
... | bsd-3-clause |
matthewwardrop/formulaic | benchmarks/plot.py | 1 | 1418 | import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
data = pd.read_csv(os.path.join(os.path.dirname(__file__), 'benchmarks.csv')).sort_values('mean')
def grouped_barplot(df, cat, subcat, val, err, subcats=None, **kwargs):
# based on https://stackoverflow.com/a/42033734
categori... | mit |
ashhher3/scikit-learn | examples/text/document_clustering.py | 31 | 8036 | """
=======================================
Clustering text documents using k-means
=======================================
This is an example showing how the scikit-learn can be used to cluster
documents by topics using a bag-of-words approach. This example uses
a scipy.sparse matrix to store the features instead of ... | bsd-3-clause |
MartinDelzant/scikit-learn | benchmarks/bench_tree.py | 297 | 3617 | """
To run this, you'll need to have installed.
* scikit-learn
Does two benchmarks
First, we fix a training set, increase the number of
samples to classify and plot number of classified samples as a
function of time.
In the second benchmark, we increase the number of dimensions of the
training set, classify a sam... | bsd-3-clause |
meduz/NeuroTools | examples/matlab_vs_python/smallnet_acml.py | 3 | 4164 | # Created by Eugene M. Izhikevich, 2003 Modified by S. Fusi 2007
# Ported to Python by Eilif Muller, 2008.
#
# Notes:
#
# Requires matplotlib,ipython,numpy>=1.0.3
# On a debian/ubuntu based system:
# $ apt-get install python-matplotlib python-numpy ipython
#
# Start ipython with threaded plotting support:
# $ ipython -... | gpl-2.0 |
mmechelke/bayesian_xfel | bxfel/core/structure_factor.py | 1 | 18608 |
import numpy as np
import scipy
import re
import os
import hashlib
import csb
from csb.bio.io.wwpdb import StructureParser
def chunks(l, n):
""" Yield successive n-sized chunks from l.
"""
for i in xrange(0, len(l), n):
yield l[i:i+n]
class ScatteringFactor(object):
"""
Cacluates the ... | mit |
bioinformatics-centre/AsmVar | src/AsmvarVarScore/FeatureToScore2.py | 2 | 12476 | """
========================================================
Statistic the SV Stat after AGE Process
========================================================
Author: Shujia Huang & Siyang Liu
Date : 2014-03-07 0idx:54:15
"""
import sys
import re
import os
import string
import numpy as np
import matplotlib.pyplot as pl... | mit |
camallen/aggregation | experimental/condor/animal_EM.py | 2 | 7334 | #!/usr/bin/env python
__author__ = 'greghines'
import numpy as np
import os
import pymongo
import sys
import cPickle as pickle
import bisect
import csv
import matplotlib.pyplot as plt
import random
import math
import urllib
import matplotlib.cbook as cbook
def index(a, x):
'Locate the leftmost value exactly equal... | apache-2.0 |
Titan-C/scikit-learn | examples/linear_model/plot_ols.py | 74 | 2047 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Linear Regression Example
=========================================================
This example uses the only the first feature of the `diabetes` dataset, in
order to illustrate a two-dimensional plot of this regre... | bsd-3-clause |
sillvan/hyperspy | doc/user_guide/conf.py | 2 | 9753 | # -*- coding: utf-8 -*-
#
# HyperSpy User Guide documentation build configuration file, created by
# sphinx-quickstart on Wed Feb 29 15:14:48 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated f... | gpl-3.0 |
danmackinlay/AutoGP | experiments/sarcos.py | 2 | 3138 | import os
import subprocess
import sklearn.cluster
import numpy as np
import autogp
from autogp import likelihoods
from autogp import kernels
import tensorflow as tf
from autogp import datasets
from autogp import losses
from autogp import util
import pandas
import scipy.io as sio
DATA_DIR = "experiments/data/"
TRAIN... | apache-2.0 |
wkfwkf/statsmodels | statsmodels/distributions/mixture_rvs.py | 27 | 9592 | from statsmodels.compat.python import range
import numpy as np
def _make_index(prob,size):
"""
Returns a boolean index for given probabilities.
Notes
---------
prob = [.75,.25] means that there is a 75% chance of the first column
being True and a 25% chance of the second column being True. The... | bsd-3-clause |
btabibian/scikit-learn | examples/linear_model/plot_multi_task_lasso_support.py | 102 | 2319 | #!/usr/bin/env python
"""
=============================================
Joint feature selection with multi-task Lasso
=============================================
The multi-task lasso allows to fit multiple regression problems
jointly enforcing the selected features to be the same across
tasks. This example simulates... | bsd-3-clause |
ssaeger/scikit-learn | sklearn/covariance/__init__.py | 389 | 1157 | """
The :mod:`sklearn.covariance` module includes methods and algorithms to
robustly estimate the covariance of features given a set of points. The
precision matrix defined as the inverse of the covariance is also estimated.
Covariance estimation is closely related to the theory of Gaussian Graphical
Models.
"""
from ... | bsd-3-clause |
kylerbrown/scikit-learn | sklearn/cross_decomposition/cca_.py | 209 | 3150 | from .pls_ import _PLS
__all__ = ['CCA']
class CCA(_PLS):
"""CCA Canonical Correlation Analysis.
CCA inherits from PLS with mode="B" and deflation_mode="canonical".
Read more in the :ref:`User Guide <cross_decomposition>`.
Parameters
----------
n_components : int, (default 2).
numb... | bsd-3-clause |
kaichogami/scikit-learn | sklearn/manifold/t_sne.py | 7 | 34867 | # Author: Alexander Fabisch -- <afabisch@informatik.uni-bremen.de>
# Author: Christopher Moody <chrisemoody@gmail.com>
# Author: Nick Travers <nickt@squareup.com>
# License: BSD 3 clause (C) 2014
# This is the exact and Barnes-Hut t-SNE implementation. There are other
# modifications of the algorithm:
# * Fast Optimi... | bsd-3-clause |
ricardog/raster-project | projections/r2py/lm.py | 1 | 1635 | from rpy2.robjects import Formula
from rpy2.robjects import pandas2ri
from rpy2.robjects.packages import importr
class LM(object):
'''Class for fitting (simple) linear models using rpy2. When extracting
the coefficients for a model (lmerMod or glmerMod) that uses orthogonal
polynomials (poly in R syntax), it is nec... | apache-2.0 |
prheenan/prhUtil | python/IgorUtil.py | 2 | 8803 | # force floating point division. Can still use integer with //
from __future__ import division
# This file is used for importing the common utilities classes.
import numpy as np
import matplotlib.pyplot as plt
# import the patrick-specific utilities
import GenUtilities as pGenUtil
import PlotUtilities as pPlotUtil
imp... | gpl-2.0 |
Myasuka/scikit-learn | setup.py | 143 | 7364 | #! /usr/bin/env python
#
# Copyright (C) 2007-2009 Cournapeau David <cournape@gmail.com>
# 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr>
# License: 3-clause BSD
descr = """A set of python modules for machine learning and data mining"""
import sys
import os
import shutil
from distutils.command.clean ... | bsd-3-clause |
mathhun/scipy_2015_sklearn_tutorial | notebooks/figures/plot_rbf_svm_parameters.py | 19 | 2018 | import matplotlib.pyplot as plt
import numpy as np
from sklearn.svm import SVC
from sklearn.datasets import make_blobs
from .plot_2d_separator import plot_2d_separator
def make_handcrafted_dataset():
# a carefully hand-designed dataset lol
X, y = make_blobs(centers=2, random_state=4, n_samples=30)
y[np.ar... | cc0-1.0 |
bcaine/maddux | maddux/environment.py | 1 | 6599 | """
Our experiment environment.
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.animation as animation
GRAVITY = -9.81
class Environment:
def __init__(self, dimensions=None, dynamic_objects=None,
static_objects=None, robot=None):... | mit |
matpalm/malmomo | viz_advantage_surface.py | 1 | 3160 | #!/usr/bin/env python
# hacktasic viz of the quadratic surface of advantage around the max output
# for a couple of clear block on right / left / center cases
import agents
import argparse
import base_network
import Image
import numpy as np
import models
import sys
import tensorflow as tf
import replay_memory
import ... | mit |
joshzarrabi/e-mission-server | emission/analysis/plotting/leaflet_osm/our_plotter.py | 1 | 14864 | import pandas as pd
import folium.folium as folium
import itertools
import numpy as np
import logging
import geojson as gj
import copy
import attrdict as ad
from functional import seq
# import emission.analysis.classification.cleaning.location_smoothing as ls
import bson.json_util as bju
import emission.storage.decor... | bsd-3-clause |
AVGInnovationLabs/DoNotSnap | train.py | 1 | 4886 | import cv2
import sys
import pickle
import numpy as np
import matplotlib.pyplot as plt
from AffineInvariantFeatures import AffineInvariant
from TemplateMatcher import TemplateMatch, Templates
from PIL import Image
from itertools import izip_longest
from sklearn.cross_validation import train_test_split
from sklearn.g... | gpl-3.0 |
hstau/covar-cryo | covariance/rotatefill.py | 1 | 1524 | '''function [out] = imrotateFill(inp, angle)
% function [out] = imrotateFill(inp)
% Rotates an 2D image couterclockwise by angle in degrees
% Output image has the same dimension as input.
% Undefined regions are filled in by repeating the original image
% Note: input images must be square
%
% Copyright (c) UWM, Peter ... | gpl-2.0 |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_compute_raw_data_spectrum.py | 8 | 3431 | """
==================================================
Compute the power spectral density of raw data
==================================================
This script shows how to compute the power spectral density (PSD)
of measurements on a raw dataset. It also show the effect of applying SSP
to the data to reduce ECG ... | bsd-3-clause |
ashhher3/seaborn | seaborn/tests/test_utils.py | 11 | 11338 | """Tests for plotting utilities."""
import warnings
import tempfile
import shutil
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import nose
import nose.tools as nt
from nose.tools import assert_equal, raises
import numpy.testing as npt
import pandas.util.testing as pdt
from distutils.version ... | bsd-3-clause |
parekhmitchell/Machine-Learning | Machine Learning A-Z Template Folder/Part 2 - Regression/Section 8 - Decision Tree Regression/regression_template.py | 22 | 1424 | # Regression Template
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Position_Salaries.csv')
X = dataset.iloc[:, 1:2].values
y = dataset.iloc[:, 2].values
# Splitting the dataset into the Training set and Test set
"""fro... | mit |
jhuapl-boss/intern | examples/dvid/general_test.py | 1 | 3757 | import intern
from intern.remote.dvid import DVIDRemote
from intern.resource.dvid.resource import DataInstanceResource
from intern.resource.dvid.resource import RepositoryResource
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
########### NOTE ###########
# This test requires an accessible DV... | apache-2.0 |
dalejung/naginpy | naginpy/special_eval/tests/test_manifest.py | 1 | 15685 | import ast
from unittest import TestCase
from textwrap import dedent
import pandas as pd
import numpy as np
from numpy.testing import assert_almost_equal
import nose.tools as nt
from asttools import (
ast_equal
)
from ..manifest import (
Expression,
Manifest,
_manifest
)
from ..exec_context import (... | mit |
erscott/Wellderly | SWGR_v1.0/masterVar_chr_split.py | 1 | 3344 | '''
Splits Complete Genomics masterVar files into chromosome specific masterVar
files when given an input file path and an output directory path.
e.g. >python masterVar_chr_split.py -i /path/to/masterVar.tsv.bz2 -o /path/to/output_dir/
Python package dependencies:
pandas, numpy
python 2.7 for argparse module
'''
... | bsd-3-clause |
DGrady/pandas | pandas/io/date_converters.py | 10 | 1827 | """This module is designed for community supported date conversion functions"""
from pandas.compat import range, map
import numpy as np
import pandas._libs.lib as lib
def parse_date_time(date_col, time_col):
date_col = _maybe_cast(date_col)
time_col = _maybe_cast(time_col)
return lib.try_parse_date_and_ti... | bsd-3-clause |
aajtodd/zipline | zipline/algorithm.py | 4 | 46969 | #
# Copyright 2014 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | apache-2.0 |
Og192/Python | machine-learning-algorithms/memoryNN/memNN_ExactTest.py | 2 | 7973 | import numpy as np
import tensorflow as tf
import os
import matplotlib.pyplot as plt
corpusSize = 1977#2358
testDataSize = 49
testMaxLength = 82
batchSize = 1
vectorLength = 50
sentMaxLength = 82
hopNumber = 3
classNumber = 4
num_epoches = 2000
weightDecay = 0.001
trainDatasetPath = "/home/laboratory/memoryCorpus/tra... | gpl-2.0 |
moreati/numpy | numpy/lib/npyio.py | 35 | 71412 | from __future__ import division, absolute_import, print_function
import sys
import os
import re
import itertools
import warnings
import weakref
from operator import itemgetter
import numpy as np
from . import format
from ._datasource import DataSource
from numpy.core.multiarray import packbits, unpackbits
from ._ioto... | bsd-3-clause |
leesavide/pythonista-docs | Documentation/matplotlib/examples/old_animation/histogram_tkagg.py | 3 | 1847 | """
This example shows how to use a path patch to draw a bunch of
rectangles for an animated histogram
"""
import numpy as np
import matplotlib
matplotlib.use('TkAgg') # do this before importing pylab
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.path as path
fig, ax = plt.sub... | apache-2.0 |
lin-credible/scikit-learn | examples/cluster/plot_kmeans_stability_low_dim_dense.py | 338 | 4324 | """
============================================================
Empirical evaluation of the impact of k-means initialization
============================================================
Evaluate the ability of k-means initializations strategies to make
the algorithm convergence robust as measured by the relative stan... | bsd-3-clause |
whn09/tensorflow | tensorflow/examples/learn/iris_custom_decay_dnn.py | 30 | 2039 | # Copyright 2016 The TensorFlow 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 by appl... | apache-2.0 |
zhuangjun1981/retinotopic_mapping | retinotopic_mapping/tools/PlottingTools.py | 1 | 15373 | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 31 11:07:20 2014
@author: junz
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
import matplotlib.colors as col
import scipy.ndimage as ni
import ImageAnalysis as ia
try:
import skimage.external.tifffile as tf
except ImportError:
i... | gpl-3.0 |
yuzie007/ph_analysis | ph_analysis/structure/displacements.py | 1 | 3767 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import numpy as np
import pandas as pd
__author__ = 'Yuji Ikeda'
__version__ = '0.1.0'
def create_statistical_functions():
return [
('sum', np.sum),
... | mit |
hugobowne/scikit-learn | examples/svm/plot_oneclass.py | 80 | 2338 | """
==========================================
One-class SVM with non-linear kernel (RBF)
==========================================
An example using a one-class SVM for novelty detection.
:ref:`One-class SVM <svm_outlier_detection>` is an unsupervised
algorithm that learns a decision function for novelty detection:
... | bsd-3-clause |
PredictiveScienceLab/py-mcmc | demos/demo4.py | 2 | 4183 | """
This demo demonstrates how to use a mean function in a GP and allow the model
to discover the most important basis functions.
This model is equivalent to a Relevance Vector Machine.
Author:
Ilias Bilionis
Date:
3/20/2014
"""
import numpy as np
import GPy
import pymcmc as pm
import matplotlib.pyplot as ... | lgpl-3.0 |
matthiasplappert/motion_classification | src/toolkit/util.py | 1 | 2470 | import numpy as np
from sklearn.utils.validation import check_array
class NotFittedError(ValueError, AttributeError):
pass
def check_feature_array(array, n_features=None):
array = check_array(array, ensure_2d=True, allow_nd=False)
if n_features is not None and array.shape[1] != n_features:
raise... | mit |
pangwong11/jumpball | bd_analyze/nba_season_stats_analyzer.py | 1 | 5069 | #!/usr/bin/python
import numpy as np
import matplotlib.pyplot as pyplot
from datetime import datetime
import os
import glob
import sys
import re
import argparse
import cv2
import random
import ast
# Argument parsing
#parser = argparse.ArgumentParser(description='Jumpball analyze')
#parser.add_argument('-s', '--seas... | apache-2.0 |
Jim61C/VTT_Show_Atten_And_Tell | prepro.py | 4 | 8670 | from scipy import ndimage
from collections import Counter
from core.vggnet import Vgg19
from core.utils import *
import tensorflow as tf
import numpy as np
import pandas as pd
import hickle
import os
import json
def _process_caption_data(caption_file, image_dir, max_length):
with open(caption_file) as f:
... | mit |
aetilley/scikit-learn | sklearn/metrics/cluster/bicluster.py | 359 | 2797 | from __future__ import division
import numpy as np
from sklearn.utils.linear_assignment_ import linear_assignment
from sklearn.utils.validation import check_consistent_length, check_array
__all__ = ["consensus_score"]
def _check_rows_and_columns(a, b):
"""Unpacks the row and column arrays and checks their shap... | bsd-3-clause |
mozman/ezdxf | examples/text_layout_engine_usage.py | 1 | 12087 | # Copyright (c) 2021, Manfred Moitzi
# License: MIT License
import sys
from typing import Iterable
import pathlib
import random
import ezdxf
from ezdxf import zoom, print_config
from ezdxf.math import Matrix44
from ezdxf.tools import fonts
from ezdxf.tools import text_layout as tl
"""
This example shows the usage o... | mit |
raymondxyang/tensorflow | tensorflow/examples/get_started/regression/linear_regression.py | 8 | 3291 | # Copyright 2016 The TensorFlow 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 by applica... | apache-2.0 |
vybstat/scikit-learn | examples/linear_model/plot_ard.py | 248 | 2622 | """
==================================================
Automatic Relevance Determination Regression (ARD)
==================================================
Fit regression model with Bayesian Ridge Regression.
See :ref:`bayesian_ridge_regression` for more information on the regressor.
Compared to the OLS (ordinary l... | bsd-3-clause |
wangmiao1981/spark | python/pyspark/sql/tests/test_pandas_cogrouped_map.py | 20 | 9306 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 |
ishanic/scikit-learn | sklearn/feature_extraction/hashing.py | 183 | 6155 | # Author: Lars Buitinck <L.J.Buitinck@uva.nl>
# License: BSD 3 clause
import numbers
import numpy as np
import scipy.sparse as sp
from . import _hashing
from ..base import BaseEstimator, TransformerMixin
def _iteritems(d):
"""Like d.iteritems, but accepts any collections.Mapping."""
return d.iteritems() if... | bsd-3-clause |
akhilaananthram/nupic.fluent | fluent/utils/text_preprocess.py | 1 | 10244 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | agpl-3.0 |
craigcitro/pydatalab | google/datalab/stackdriver/monitoring/_query.py | 5 | 2818 | # Copyright 2016 Google Inc. 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 by applicable law or agreed... | apache-2.0 |
karstenw/nodebox-pyobjc | examples/Extended Application/matplotlib/examples/lines_bars_and_markers/simple_plot.py | 1 | 1292 | """
===========
Simple Plot
===========
Create a simple plot.
"""
import matplotlib.pyplot as plt
import numpy as np
# nodebox section
if __name__ == '__builtin__':
# were in nodebox
import os
import tempfile
W = 800
inset = 20
size(W, 600)
plt.cla()
plt.clf()
plt.close('all')
... | mit |
adelomana/cassandra | conditionedFitness/figurePatterns/script.sustained.py | 2 | 1771 | import pickle
import statsmodels,statsmodels.api
import matplotlib,matplotlib.pyplot
matplotlib.rcParams.update({'font.size':36,'font.family':'Arial','xtick.labelsize':28,'ytick.labelsize':28})
thePointSize=12
# 0. user defined variables
jarDir='/Users/adriandelomana/scratch/'
# sustained trajectories
selected=['clon... | gpl-3.0 |
gnychis/grforwarder | gnuradio-examples/python/pfb/resampler.py | 7 | 4207 | #!/usr/bin/env python
#
# Copyright 2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
... | gpl-3.0 |
xubenben/data-science-from-scratch | code/clustering.py | 60 | 6438 | from __future__ import division
from linear_algebra import squared_distance, vector_mean, distance
import math, random
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
class KMeans:
"""performs k-means clustering"""
def __init__(self, k):
self.k = k # number of clusters
... | unlicense |
deepesch/scikit-learn | examples/text/hashing_vs_dict_vectorizer.py | 284 | 3265 | """
===========================================
FeatureHasher and DictVectorizer Comparison
===========================================
Compares FeatureHasher and DictVectorizer by using both to vectorize
text documents.
The example demonstrates syntax and speed only; it doesn't actually do
anything useful with the e... | bsd-3-clause |
Starkiller4011/astroSF | m2_convert.py | 1 | 1131 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
#####################################
# ╔╗ ┬ ┬ ┬┌─┐ ╔╦╗┌─┐┌┬┐ #
# ╠╩╗│ │ │├┤ ║║│ │ │ #
# ╚═╝┴─┘└─┘└─┘ ═╩╝└─┘ ┴ #
# ╔═╗┌─┐┌─┐┌┬┐┬ ┬┌─┐┬─┐┌─┐ #
# ╚═╗│ │├┤ │ │││├─┤├┬┘├┤ #
# ╚═╝└─┘└ ┴ └┴┘┴ ┴┴└─└─┘ #
###... | mit |
wei-Z/Python-Machine-Learning | self_practice/CH2A.py | 1 | 4506 | import numpy as np
class Perceptron(object):
"""Perceptron classifier.
Parameters
------------
eta : float
Learning rate (between 0.0 and 1.0)
n_iter : int
Passes over the training dataset.
Attributes
-----------
w_ : 1d-array
Weig... | mit |
CVML/scikit-learn | sklearn/tests/test_multiclass.py | 72 | 24581 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing ... | bsd-3-clause |
mrshu/scikit-learn | sklearn/preprocessing.py | 1 | 40726 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# License: BSD
from collections import Sequence
import warnings
import numbers
import numpy as np
imp... | bsd-3-clause |
mganeva/mantid | qt/python/mantidqt/project/projectsaver.py | 1 | 5274 | # Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
# This file is part of the mantidqt package
... | gpl-3.0 |
DaveBackus/Data_Bootcamp | Code/Lab/googlefinance.py | 1 | 3562 | """
This file demonstrates how to read minute level data from the
Google finance api
"""
import datetime as dt
import numpy as np
import pandas as pd
import pandas_datareader as pdr
import requests as r
import sys
from io import StriongIO
def retrieve_single_timeseries(ticker, secs=60, ndays=5):
"""
Grabs da... | mit |
dingocuster/scikit-learn | sklearn/metrics/regression.py | 175 | 16953 | """Metrics to assess performance on regression task
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Ma... | bsd-3-clause |
PetaVision/projects | momentLearn/scripts/recon_simple.py | 2 | 1138 | import os, sys
lib_path = os.path.abspath("/home/slundquist/workspace/PetaVision/plab/")
sys.path.append(lib_path)
from plotRecon import plotRecon
from plotReconError import plotReconError
#For plotting
#import matplotlib.pyplot as plt
outputDir = "/nh/compneuro/Data/momentLearn/output/simple_momentum_out/"
skipFrame... | epl-1.0 |
kaichogami/scikit-learn | examples/cluster/plot_ward_structured_vs_unstructured.py | 320 | 3369 | """
===========================================================
Hierarchical clustering: structured vs unstructured ward
===========================================================
Example builds a swiss roll dataset and runs
hierarchical clustering on their position.
For more information, see :ref:`hierarchical_clus... | bsd-3-clause |
Obus/scikit-learn | benchmarks/bench_glmnet.py | 297 | 3848 | """
To run this, you'll need to have installed.
* glmnet-python
* scikit-learn (of course)
Does two benchmarks
First, we fix a training set and increase the number of
samples. Then we plot the computation time as function of
the number of samples.
In the second benchmark, we increase the number of dimensions of... | bsd-3-clause |
MBARIMike/stoqs | stoqs/contrib/parquet/extract_columns.py | 2 | 11789 | #!/usr/bin/env python
"""
Pull all the temperature and salinity data out of a STOQS database no
matter what platform and write it out in Parquet file format.
This is a companion to select_data_in_columns_for_data_science.ipynb
where we operationalize the explorations demonstrated in this Notebook:
https://nbviewer.j... | gpl-3.0 |
gwpy/seismon | RfPrediction/StackedEnsemble_Rfamplitude_prediction.py | 2 | 11411 | # Stacked Ensemble RfAmp Prediction Model
# Multiple ML regressors are individually trained and then combined via meta-regressor.
# Hyperparameters are tuned via GridSearchCV
# coding: utf-8
from __future__ import division
import optparse
import numpy as np
import pandas as pd
import os
if not os.getenv("DISPLAY"... | gpl-3.0 |
hiuwo/acq4 | acq4/analysis/tools/Fitting.py | 1 | 36006 | #!/usr/bin/env python
"""
Python class wrapper for data fitting.
Includes the following external methods:
getFunctions returns the list of function names (dictionary keys)
FitRegion performs the fitting
Note that FitRegion will plot on top of the current data using MPlots routines
if the current curve and the current ... | mit |
nilearn/nilearn_sandbox | examples/rpbi/plot_localizer_rpbi.py | 1 | 4435 | """
Massively univariate analysis of a computation task from the Localizer dataset
==============================================================================
A permuted Ordinary Least Squares algorithm is run at each voxel in
order to determine which voxels are specifically active when a healthy subject
performs a... | bsd-3-clause |
zutshi/S3CAMR | examples/spi/spi_plant.py | 1 | 2022 |
# Must satisfy the signature
# [t,X,D,P] = sim_function(T,X0,D0,P0,I0);
import numpy as np
from scipy.integrate import ode
import matplotlib.pyplot as PLT
PLOT = True
class SIM(object):
def __init__(self, plt, pvt_init_data):
#print I
# atol = 1e-10
rtol = 1e-5
# tt,YY,dummy_D,... | bsd-2-clause |
pvcrossi/OnlineCS | online_CS.py | 1 | 4043 | '''
Bayesian Online Compressed Sensing (2016)
Paulo V. Rossi & Yoshiyuki Kabashima
'''
from collections import namedtuple
import matplotlib.pyplot as plt
import numpy as np
from numpy.linalg import norm
from numpy.random import normal
from utils import DlnH, DDlnH, G, H, moments
def simulation(method='standard'):
... | mit |
nelango/ViralityAnalysis | model/lib/pandas/tests/test_internals.py | 9 | 45145 | # -*- coding: utf-8 -*-
# pylint: disable=W0102
from datetime import datetime, date
import nose
import numpy as np
import re
import itertools
from pandas import Index, MultiIndex, DataFrame, DatetimeIndex, Series, Categorical
from pandas.compat import OrderedDict, lrange
from pandas.sparse.array import SparseArray
f... | mit |
pySTEPS/pysteps | examples/plot_optical_flow.py | 1 | 5240 | """
Optical flow
============
This tutorial offers a short overview of the optical flow routines available in
pysteps and it will cover how to compute and plot the motion field from a
sequence of radar images.
"""
from datetime import datetime
from pprint import pprint
import matplotlib.pyplot as plt
im... | bsd-3-clause |
ryandougherty/mwa-capstone | MWA_Tools/build/matplotlib/doc/mpl_examples/units/evans_test.py | 3 | 2335 | """
A mockup "Foo" units class which supports
conversion and different tick formatting depending on the "unit".
Here the "unit" is just a scalar conversion factor, but this example shows mpl is
entirely agnostic to what kind of units client packages use
"""
import matplotlib
from matplotlib.cbook import iterable
impo... | gpl-2.0 |
sjperkins/tensorflow | tensorflow/python/estimator/canned/dnn_linear_combined_test.py | 5 | 26973 | # Copyright 2017 The TensorFlow 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 by applica... | apache-2.0 |
aweimann/traitar | traitar/heatmap.py | 1 | 19822 | #!/usr/bin/env python
#adapted from Nathan Salomonis: http://code.activestate.com/recipes/578175-hierarchical-clustering-heatmap-python/
import matplotlib as mpl
#pick non-x display
mpl.use('Agg')
import matplotlib.pyplot as pylab
import scipy
import scipy.cluster.hierarchy as sch
import scipy.spatial.distance as dist... | gpl-3.0 |
balazssimon/ml-playground | udemy/lazyprogrammer/reinforcement-learning-python/comparing_explore_exploit_methods.py | 1 | 2913 | import numpy as np
import matplotlib.pyplot as plt
from comparing_epsilons import Bandit
from optimistic_initial_values import run_experiment as run_experiment_oiv
from ucb1 import run_experiment as run_experiment_ucb
class BayesianBandit:
def __init__(self, true_mean):
self.true_mean = true_mean
... | apache-2.0 |
diego0020/PySurfer | examples/plot_label.py | 4 | 1526 | """
Display ROI Labels
==================
Using PySurfer you can plot Freesurfer cortical labels on the surface
with a large amount of control over the visual representation.
"""
import os
from surfer import Brain
print(__doc__)
subject_id = "fsaverage"
hemi = "lh"
surf = "smoothwm"
brain = Brain(subject_id, hemi, ... | bsd-3-clause |
akpetty/ibtopo2016 | calc_multi_atm.py | 1 | 9475 | ##############################################################
# Date: 20/01/16
# Name: calc_multi_atm.py
# Author: Alek Petty
# Description: Main script to calculate sea ice topography from IB ATM data
# Input requirements: ATM data, PosAV data (for geolocation)
# Output: topography datasets
import matplotlib
matplo... | gpl-3.0 |
jseabold/scikit-learn | sklearn/manifold/tests/test_locally_linear.py | 232 | 4761 | from itertools import product
from nose.tools import assert_true
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from scipy import linalg
from sklearn import neighbors, manifold
from sklearn.manifold.locally_linear import barycenter_kneighbors_graph
from sklearn.utils.testi... | bsd-3-clause |
ishank08/scikit-learn | examples/applications/plot_stock_market.py | 76 | 8522 | """
=======================================
Visualizing the stock market structure
=======================================
This example employs several unsupervised learning techniques to extract
the stock market structure from variations in historical quotes.
The quantity that we use is the daily variation in quote ... | bsd-3-clause |
nvoron23/scikit-learn | sklearn/feature_extraction/image.py | 263 | 17600 | """
The :mod:`sklearn.feature_extraction.image` submodule gathers utilities to
extract features from images.
"""
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Olivier Grisel
# Vlad Niculae
# License: BSD 3 clause
fro... | bsd-3-clause |
zihua/scikit-learn | sklearn/model_selection/tests/test_validation.py | 6 | 30876 | """Test the validation module"""
from __future__ import division
import sys
import warnings
import tempfile
import os
from time import sleep
import numpy as np
from scipy.sparse import coo_matrix, csr_matrix
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.uti... | bsd-3-clause |
quheng/scikit-learn | sklearn/preprocessing/tests/test_label.py | 156 | 17626 | import numpy as np
from scipy.sparse import issparse
from scipy.sparse import coo_matrix
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sparse import dok_matrix
from scipy.sparse import lil_matrix
from sklearn.utils.multiclass import type_of_target
from sklearn.utils.testing impor... | bsd-3-clause |
alpenwasser/laborjournal | versuche/skineffect/python/stuetzpunkte_new_lowfreq.py | 1 | 6373 | #!/usr/bin/env python3
from sympy import *
from mpmath import *
from matplotlib.pyplot import *
#init_printing() # make things prettier when we print stuff for debugging.
# ************************************************************************** #
# Magnetic field inside copper coil with hollow copper cylinde... | mit |
RomainBrault/scikit-learn | sklearn/datasets/__init__.py | 61 | 3734 | """
The :mod:`sklearn.datasets` module includes utilities to load datasets,
including methods to load and fetch popular reference datasets. It also
features some artificial data generators.
"""
from .base import load_breast_cancer
from .base import load_boston
from .base import load_diabetes
from .base import load_digi... | bsd-3-clause |
stscieisenhamer/glue | glue/core/data_factories/excel.py | 5 | 1367 | from __future__ import absolute_import, division, print_function
import os
from glue.core.data_factories.helpers import has_extension
from glue.core.data_factories.pandas import panda_process
from glue.config import data_factory
__all__ = []
@data_factory(label="Excel", identifier=has_extension('xls xlsx'))
def p... | bsd-3-clause |
jefffohl/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backend_bases.py | 69 | 69740 | """
Abstract base classes define the primitives that renderers and
graphics contexts must implement to serve as a matplotlib backend
:class:`RendererBase`
An abstract base class to handle drawing/rendering operations.
:class:`FigureCanvasBase`
The abstraction layer that separates the
:class:`matplotlib.fi... | gpl-3.0 |
southpaw94/MachineLearning | Perceptron/Iris.py | 1 | 1993 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from Perceptron import Perceptron
def plotRawData():
plt.scatter(X[:50, 0], X[:50, 1], color='red', marker='o', label='setosa')
plt.scatter(X[50:100, 0], X[50:100, 1], color='blue', marker='x', ... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.