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 |
|---|---|---|---|---|---|
tsgit/invenio | modules/bibauthorid/lib/bibauthorid_tortoise.py | 5 | 16153 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2011, 2012 CERN.
#
# Invenio 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 2 of the
# License, or (at your option) any... | gpl-2.0 |
poryfly/scikit-learn | benchmarks/bench_plot_approximate_neighbors.py | 244 | 6011 | """
Benchmark for approximate nearest neighbor search using
locality sensitive hashing forest.
There are two types of benchmarks.
First, accuracy of LSHForest queries are measured for various
hyper-parameters and index sizes.
Second, speed up of LSHForest queries compared to brute force
method in exact nearest neigh... | bsd-3-clause |
PMBio/limix | limix/scripts/iSet_postprocess.py | 1 | 2451 | #! /usr/bin/env python
# Copyright(c) 2014, The mtSet developers (Francesco Paolo Casale, Barbara Rakitsch, Oliver Stegle)
# All rights reserved.
from optparse import OptionParser
from limix.mtSet.core.iset_utils import calc_emp_pv_eff
import pandas as pd
import glob
import os
import time
import sys
def entry_point()... | apache-2.0 |
SamStudio8/scikit-bio | skbio/io/format/ordination.py | 8 | 14555 | r"""
Ordination results format (:mod:`skbio.io.format.ordination`)
=============================================================
.. currentmodule:: skbio.io.format.ordination
The ordination results file format (``ordination``) stores the results of an
ordination method in a human-readable, text-based format. The form... | bsd-3-clause |
RPGOne/Skynet | scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/sklearn/decomposition/tests/test_dict_learning.py | 40 | 7535 | import numpy as np
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_raises
... | bsd-3-clause |
mugizico/scikit-learn | sklearn/neighbors/tests/test_nearest_centroid.py | 305 | 4121 | """
Testing for the nearest centroid module.
"""
import numpy as np
from scipy import sparse as sp
from numpy.testing import assert_array_equal
from numpy.testing import assert_equal
from sklearn.neighbors import NearestCentroid
from sklearn import datasets
from sklearn.metrics.pairwise import pairwise_distances
# t... | bsd-3-clause |
VaclavDedik/classifier | classifier/models.py | 1 | 5190 | import numpy as np
import operator
from sklearn import naive_bayes
from sklearn import svm, tree
from kernels import GaussianKernel
class AbstractModel(object):
"""Abstract model of a learning algorithm. When implementing a subclass,
you have to implement method ``train``. Method ``predict`` is implemented
... | mit |
Noahs-ARK/ARKcat | download_20ng.py | 2 | 3942 | from sklearn.datasets import fetch_20newsgroups
import os, sys
import subprocess, random
import unicodedata
base = "/cab1/corpora/bayes_opt/20_newsgroups/"
groups = {'all_topics':['talk.religion.misc', 'comp.windows.x', 'rec.sport.baseball', 'talk.politics.mideast', 'comp.sys.mac.hardware', 'sci.space', 'talk.pol... | apache-2.0 |
jcnelson/syndicate | papers/paper-nsdi2013/data/tools/analysis/Nr1w.py | 2 | 9504 | #!/usr/bin/python
import analysis
import os
import sys
import numpy as np
import statsmodels.api as sm
import matplotlib.pyplot as plt
def eval_dict( s ):
ret = None
try:
exec("ret = " + s)
except:
return None
return ret
def cdf_compare( dists, title, xl, xr, yl, yr, labels ):
mm = min(di... | apache-2.0 |
iulian787/spack | var/spack/repos/builtin/packages/py-sncosmo/package.py | 5 | 1133 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PySncosmo(PythonPackage):
"""SNCosmo is a Python library for high-level supernova cosmolog... | lgpl-2.1 |
jreback/pandas | pandas/conftest.py | 1 | 37035 | """
This file is very long and growing, but it was decided to not split it yet, as
it's still manageable (2020-03-17, ~1.1k LoC). See gh-31989
Instead of splitting it was decided to define sections here:
- Configuration / Settings
- Autouse fixtures
- Common arguments
- Missing values & co.
- Classes
- Indices
- Serie... | bsd-3-clause |
waterponey/scikit-learn | sklearn/utils/random.py | 46 | 10523 | # Author: Hamzeh Alsalhi <ha258@cornell.edu>
#
# License: BSD 3 clause
from __future__ import division
import numpy as np
import scipy.sparse as sp
import operator
import array
from sklearn.utils import check_random_state
from sklearn.utils.fixes import astype
from ._random import sample_without_replacement
__all__ =... | bsd-3-clause |
margulies/topography | utils_py/paths_find_similar.py | 4 | 4083 | #get_ipython().magic(u'matplotlib inline')
import matplotlib.pyplot as plt
from scipy.spatial.distance import pdist, squareform
import scipy.io as sio
import h5py
import networkx as nx
import numpy as np
import gdist
def calcPaths(num):
length = nx.all_pairs_dijkstra_path(G, num)
length_paths = []
for node... | mit |
evenmarbles/mlpy | mlpy/knowledgerep/cbr/similarity.py | 1 | 17713 | from __future__ import division, print_function, absolute_import
import math
import numpy as np
from abc import ABCMeta, abstractmethod
from sklearn.neighbors import NearestNeighbors
from sklearn.cluster import KMeans
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.neighbors.dist_metrics import M... | mit |
sanketloke/scikit-learn | sklearn/metrics/base.py | 46 | 4627 | """
Common code for all metrics
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Arnaud Joly <a.joly@ulg.ac.be>
# Jochen Wersdorfer <jochen@wersdoerfer.de>
# Lars Buitinck
... | bsd-3-clause |
ankurankan/pgmpy | pgmpy/tests/test_estimators/test_HillClimbSearch.py | 2 | 9288 | import unittest
import pandas as pd
import numpy as np
from pgmpy.estimators import HillClimbSearch, K2Score
from pgmpy.models import BayesianNetwork
class TestHillClimbEstimator(unittest.TestCase):
def setUp(self):
self.rand_data = pd.DataFrame(
np.random.randint(0, 5, size=(int(1e4), 2)), ... | mit |
cython-testbed/pandas | pandas/core/apply.py | 4 | 12744 | import warnings
import numpy as np
from pandas import compat
from pandas._libs import reduction
from pandas.core.dtypes.generic import ABCSeries
from pandas.core.dtypes.common import (
is_extension_type,
is_dict_like,
is_list_like,
is_sequence)
from pandas.util._decorators import cache_readonly
from pa... | bsd-3-clause |
xguse/ggplot | setup.py | 13 | 2169 | import os
from setuptools import find_packages, setup
def extract_version():
"""
Extracts version values from the main matplotlib __init__.py and
returns them as a dictionary.
"""
with open('ggplot/__init__.py') as fd:
for line in fd.readlines():
if (line.startswith('__version__... | bsd-2-clause |
mugizico/scikit-learn | sklearn/tests/test_calibration.py | 213 | 12219 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from sklearn.utils.testing import (assert_array_almost_equal, assert_equal,
assert_greater, assert_almost_equal,
... | bsd-3-clause |
edublancas/sklearn-evaluation | src/sklearn_evaluation/metrics.py | 2 | 4986 | # from collections import OrderedDict
import numpy as np
from sklearn.metrics import precision_score
from sklearn_evaluation.preprocessing import binarize
from sklearn_evaluation import util
from sklearn_evaluation import validate
def compute_at_thresholds(fn, y_true, y_score, n_thresholds=10, start=0.0):
"""
... | mit |
saihttam/kaggle-axa | RobustRegressionDriver.py | 1 | 5500 | import numpy as np
from sklearn.ensemble import GradientBoostingRegressor
from random import sample, seed
from sklearn.decomposition import TruncatedSVD
from math import floor
from sklearn import cross_validation
import numpy as np
from numpy.linalg import norm, svd
def inexact_augmented_lagrange_multiplier(X, lmbda=... | bsd-2-clause |
AE4317group07/paparazzi | sw/tools/calibration/calibration_utils.py | 27 | 12769 |
# Copyright (C) 2010 Antoine Drouin
#
# This file is part of Paparazzi.
#
# Paparazzi 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 2, or (at your option)
# any later version.
#
# Paparazzi ... | gpl-2.0 |
cjayb/kingjr_natmeg_arhus | JR_toolbox/skl_king_parallel_gs.py | 2 | 15257 |
print("######################################################################")
print("# Parallel n-split k-stratified-fold continuous SVM Scikitlearn MVPA #")
print("# (c) Jean-Remi King 2012, jeanremi.king [at] gmail [dot] com #")
print("######################################################################")... | bsd-3-clause |
eickenberg/scikit-learn | sklearn/cluster/tests/test_dbscan.py | 16 | 5134 | """
Tests for DBSCAN clustering algorithm
"""
import pickle
import numpy as np
from numpy.testing import assert_raises
from scipy.spatial import distance
from sklearn.utils.testing import assert_equal
from sklearn.cluster.dbscan_ import DBSCAN, dbscan
from .common import generate_clustered_data
from sklearn.metrics... | bsd-3-clause |
OCM-Lab-PUC/switch-chile | python_utility_scripts/create_transmission_csv.py | 1 | 5810 | # -*- coding: utf-8 -*-
# Copyright 2016 The Switch-Chile Authors. All rights reserved.
# Licensed under the Apache License, Version 2, which is in the LICENSE file.
# Operations, Control and Markets laboratory at Pontificia Universidad
# Católica de Chile.
import pandas, os, re, datetime, sys
from unidecode import un... | apache-2.0 |
SvichkarevAnatoly/Course-Python-Bioinformatics | semester2/task8/exercise2.py | 1 | 3387 | import numpy
import random
import matplotlib.pyplot as plot
from sklearn.tree import DecisionTreeRegressor
from sklearn import tree
a = 1
b = 2
# Build a simple data set with y = x + random
nPoints = 1000
# x values for plotting
xPlot = [(float(i) / float(nPoints) - 0.5) for i in range(nPoints + 1)]
# x needs to b... | gpl-2.0 |
miyyer/qb | qanta/hyperparam.py | 2 | 1848 | import copy
import json
import yaml
from sklearn.model_selection import ParameterGrid
def expand_config(base_file, hyper_file, output_file):
"""
This is useful for taking the qanta.yaml config, a set of values to try for different hyper parameters, and
generating a configuration representing each value in... | mit |
chrisjdavie/shares | machine_learning/sklearn_dataset_format.py | 1 | 1160 | '''
Created on 2 Sep 2014
@author: chris
'''
'''File format - data, length of data, containing unicode
- target, length of data, contains int reference to target
- target_names, type names relative to target
- filenames, names of files storing data (probably target too)
... | mit |
rexshihaoren/scikit-learn | sklearn/feature_extraction/tests/test_feature_hasher.py | 258 | 2861 | from __future__ import unicode_literals
import numpy as np
from sklearn.feature_extraction import FeatureHasher
from nose.tools import assert_raises, assert_true
from numpy.testing import assert_array_equal, assert_equal
def test_feature_hasher_dicts():
h = FeatureHasher(n_features=16)
assert_equal("dict",... | bsd-3-clause |
aleju/imgaug | imgaug/augmentables/heatmaps.py | 2 | 25136 | """Classes to represent heatmaps, i.e. float arrays of ``[0.0, 1.0]``."""
from __future__ import print_function, division, absolute_import
import numpy as np
import six.moves as sm
from .. import imgaug as ia
from .base import IAugmentable
class HeatmapsOnImage(IAugmentable):
"""Object representing heatmaps on ... | mit |
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/pandas/tests/util/test_move.py | 2 | 1457 | import pytest
from pandas.util._move import BadMove, move_into_mutable_buffer, stolenbuf
def test_cannot_create_instance_of_stolen_buffer():
# Stolen buffers need to be created through the smart constructor
# "move_into_mutable_buffer," which has a bunch of checks in it.
msg = "cannot create 'pandas.uti... | apache-2.0 |
LaboratoireMecaniqueLille/crappy | crappy/blocks/grapher.py | 1 | 5641 | # coding: utf-8
import numpy as np
from .block import Block
from .._global import OptionalModule
try:
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
except (ModuleNotFoundError, ImportError):
plt = OptionalModule("matplotlib")
Button = OptionalModule("matplotlib")
class Grapher(Block... | gpl-2.0 |
maropu/spark | python/pyspark/pandas/namespace.py | 2 | 104198 | #
# 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 |
xi-studio/anime | newnet/show.py | 1 | 1080 | import numpy as np
import matplotlib.pyplot as plt
from scipy.sparse import csc_matrix
head = np.random.randint(low=0,high=10,size=20)
tail = np.random.randint(low=0,high=10,size=20)
row = np.arange(20)
data = np.ones(20)
a = csc_matrix((data, (row,head)),shape=(20,10)).toarray()
b = csc_matrix((data, (row,tail)),sha... | mit |
aptiko/enhydris | enhydris/tests/test_models.py | 2 | 51867 | import datetime as dt
from io import StringIO
from unittest import mock
from django.contrib.auth.models import User
from django.contrib.gis.geos import MultiPolygon, Point, Polygon
from django.db import IntegrityError
from django.db.models.signals import post_save
from django.test import TestCase, override_settings
fr... | agpl-3.0 |
cemonatk/tools | DSBSCModulation.py | 2 | 1699 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__date__ = '10.10.2016'
__author__ = 'cemonatk'
from numpy import cos,pi,sin,arange
from matplotlib.pyplot import plot,show,title,subplot,suptitle,xlabel,imshow
from matplotlib.image import imread
from Tkinter import *
def DSBSCModulate(fm,fc,aralik):
suptitle('Analo... | mit |
neale/CS-program | 434-MachineLearning/final_project/linearClassifier/sklearn/metrics/tests/test_ranking.py | 32 | 41905 | from __future__ import division, print_function
import numpy as np
from itertools import product
import warnings
from scipy.sparse import csr_matrix
from sklearn import datasets
from sklearn import svm
from sklearn import ensemble
from sklearn.datasets import make_multilabel_classification
from sklearn.random_projec... | unlicense |
goodfeli/pylearn2 | pylearn2/scripts/datasets/browse_small_norb.py | 44 | 6901 | #!/usr/bin/env python
import sys
import argparse
import pickle
import warnings
import exceptions
import numpy
try:
from matplotlib import pyplot
except ImportError as import_error:
warnings.warn("Can't use this script without matplotlib.")
pyplot = None
from pylearn2.datasets import norb
warnings.warn("T... | bsd-3-clause |
Ginkgo-Biloba/Misc-Python | numpy/SciPyInt.py | 1 | 3425 | # coding=utf-8
import numpy as np
from scipy import integrate as intgrt
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from math import sqrt
# 计算半球的体积
def ballVolume():
def halfBall(x, y):
return sqrt(1 - x**2 - y**2)
def halfCircle(x):
return sqrt(1 - x**2)
(vol, error) = intgrt.dblqua... | gpl-3.0 |
phillynch7/sportsref | sportsref/nba/seasons.py | 1 | 9902 | from __future__ import print_function
from __future__ import division
from future import standard_library
standard_library.install_aliases()
from builtins import range, zip
from past.utils import old_div
import urllib.parse
import future
import future.utils
import numpy as np
import pandas as pd
from pyquery import P... | gpl-3.0 |
PatrickChrist/scikit-learn | benchmarks/bench_plot_ward.py | 290 | 1260 | """
Benchmark scikit-learn's Ward implement compared to SciPy's
"""
import time
import numpy as np
from scipy.cluster import hierarchy
import pylab as pl
from sklearn.cluster import AgglomerativeClustering
ward = AgglomerativeClustering(n_clusters=3, linkage='ward')
n_samples = np.logspace(.5, 3, 9)
n_features = n... | bsd-3-clause |
zzcclp/spark | python/pyspark/pandas/tests/plot/test_frame_plot_matplotlib.py | 14 | 18666 | #
# 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 |
wazeerzulfikar/scikit-learn | sklearn/externals/joblib/__init__.py | 54 | 5087 | """Joblib is a set of tools to provide **lightweight pipelining in
Python**. In particular, joblib offers:
1. transparent disk-caching of the output values and lazy re-evaluation
(memoize pattern)
2. easy simple parallel computing
3. logging and tracing of the execution
Joblib is optimized to be **fast** and **r... | bsd-3-clause |
zoranzhao/NoSSim | NoS_Vgraph/core_util_plot.py | 1 | 5568 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
def plot(srv_app, srv_lwip, cli_app, cli_lwip):
#srv_app = {0:[],1:[],2:[]}
#srv_... | bsd-3-clause |
adammenges/statsmodels | statsmodels/examples/tsa/arma_plots.py | 33 | 2516 | '''Plot acf and pacf for some ARMA(1,1)
'''
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.tsa.arima_process as tsp
from statsmodels.sandbox.tsa.fftarma import ArmaFft as FftArmaProcess
import statsmodels.tsa.stattools as tss
from statsmodels.graphics.tsap... | bsd-3-clause |
rgllm/uminho | 04/CN/TP3/src/src/parser/PsoTools.py | 1 | 4783 | import itertools
import json
import matplotlib.pyplot as plt
from matplotlib import style
import os
style.use('ggplot')
import numpy as np
from pprint import pprint
from os.path import basename
xrange=range
class PsoTools(object):
def __init__(self):
pass
# Convert a data raw file to a json file
def rawToJso... | mit |
jat255/seaborn | seaborn/timeseries.py | 4 | 15212 | """Timeseries plotting functions."""
from __future__ import division
import numpy as np
import pandas as pd
from scipy import stats, interpolate
import matplotlib as mpl
import matplotlib.pyplot as plt
from .external.six import string_types
from . import utils
from . import algorithms as algo
from .palettes import c... | bsd-3-clause |
cbyn/bitpredict | app/run_charts_extended.py | 2 | 5244 | import pandas as pd
import pymongo
from bokeh.plotting import cursession, figure, output_server, push
from bokeh.models.formatters import DatetimeTickFormatter, PrintfTickFormatter
from bokeh.io import vplot
from bokeh import embed
from json import load
from urllib2 import urlopen
import time
client = pymongo.MongoCli... | mit |
JensWehner/votca-scripts | xtp/xtp_kmc_plottrajectory.py | 2 | 3563 | #!/usr/bin/env python
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d import proj3d
import numpy as np
import matplotlib.pyplot as plt
import csv
import re
import sys
from __tools__ import MyParser
parser=MyParser(description="Tool to visualize kmc trajectory .csv files" )
... | apache-2.0 |
richardhsu/naarad | src/naarad/graphing/matplotlib_naarad.py | 4 | 9100 | # coding=utf-8
"""
Copyright 2013 LinkedIn Corp. 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 l... | apache-2.0 |
ContextLab/quail | quail/analysis/lagcrp.py | 1 | 4765 | import numpy as np
import pandas as pd
from .recmat import recall_matrix
from scipy.spatial.distance import cdist
from ..helpers import check_nan
def lagcrp_helper(egg, match='exact', distance='euclidean',
ts=None, features=None):
"""
Computes probabilities for each transition distance (proba... | mit |
sbhal/be-fruitful | pythonProject/qlearning_tf.py | 1 | 5122 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 8 19:14:33 2017
@author: sbhal
"""
import numpy as np
import pandas as pd
import random
import tensorflow as tf
class qlearningTF:
def __init__(self, m_criteria, initialWeights=None):
if initialWeights == None:
self.weight... | mit |
kyleabeauchamp/EnsemblePaper | code/model_building/evaluate_BW_entropy.py | 1 | 1791 | import pandas as pd
import numpy as np
from fitensemble import bayesian_weighting, belt
import experiment_loader
import ALA3
prior = "BW"
ff = "amber96"
stride = 1000
regularization_strength = 10.0
thin = 400
factor = 50
steps = 1000000
predictions_framewise, measurements, uncertainties = experiment_loader.load(ff, ... | gpl-3.0 |
weidel-p/nest-simulator | pynest/examples/brette_gerstner_fig_3d.py | 12 | 3030 | # -*- coding: utf-8 -*-
#
# brette_gerstner_fig_3d.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 2 of the ... | gpl-2.0 |
ODM2/YODA-Tools | yodatools/converter/Abstract/iOutputs.py | 2 | 2345 | from odm2api.models import Base, TimeSeriesResultValues
from sqlalchemy.exc import IntegrityError, ProgrammingError
import sqlalchemy.ext.declarative.api as api
import pandas as pd
from sqlalchemy import func
class iOutputs:
def __init__(self):
pass
def parseObjects(self, session):
data = {}... | bsd-3-clause |
yugangzhang/chxanalys | chxanalys/chx_compress.py | 1 | 37856 | import os,shutil
from glob import iglob
import matplotlib.pyplot as plt
from chxanalys.chx_libs import (np, roi, time, datetime, os, getpass, db,
get_images,LogNorm, RUN_GUI)
from chxanalys.chx_generic_functions import (create_time_slice,get_detector, get_fields, get_sid_filenam... | bsd-3-clause |
josauder/procedural_city_generation | UI.py | 2 | 3982 | import os
import sys
import procedural_city_generation
donemessage = "\n"+(150*"-")+"\n\t\t\t Done, waiting for command\n"+(150*"-")+"\n"
path = os.path.dirname(procedural_city_generation.__file__)
sys.path.append(path)
if not os.path.exists(path+"/temp/"):
os.system("mkdir "+path+"/temp")
if not os.path.exists(pa... | mpl-2.0 |
burakbayramli/dersblog | tser/tser_005_intro/common.py | 2 | 8217 | import pandas as pd
import numpy as np
import scipy.stats as st
DAYS_IN_YEAR=256.0
ROOT_DAYS_IN_YEAR=DAYS_IN_YEAR**.5
useroot=""
def cap_forecast(xrow, capmin,capmax):
"""
Cap forecasts.
"""
## Assumes we have a single column
x=xrow[0]
if x<capmin:
return capmin
elif x>c... | gpl-3.0 |
madjelan/scikit-learn | sklearn/decomposition/tests/test_dict_learning.py | 85 | 8565 | import numpy as np
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_raises... | bsd-3-clause |
liyu1990/sklearn | examples/linear_model/plot_lasso_and_elasticnet.py | 73 | 2074 | """
========================================
Lasso and Elastic Net for Sparse Signals
========================================
Estimates Lasso and Elastic-Net regression models on a manually generated
sparse signal corrupted with an additive noise. Estimated coefficients are
compared with the ground-truth.
"""
print(... | bsd-3-clause |
jiansenzheng/oanda_trading | oanda_trading/forex_trading_general_171005.py | 1 | 27162 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 06 20:00:30 2016
@author: Jiansen
"""
import requests
import threading
import copy
import logging
import os
#import urllib3
import json
from scipy import stats
#from decimal import Decimal, getcontext, ROUND_HALF_DOWN
#from event00 import TickEvent,Tick... | gpl-3.0 |
mhbashari/machine-learning-snippets | Basic/01-linear_regression_tensorflow.py | 1 | 2015 | import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from numpy.core.multiarray import ndarray
__author__ = "mhbashari"
class LinearRegression:
def __init__(self, train_X: ndarray, train_Y: ndarray, learning_rate=0.001, training_epochs=100):
self.train_X = train_X
self.train... | mit |
nmayorov/scikit-learn | sklearn/linear_model/logistic.py | 9 | 67760 |
"""
Logistic Regression
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Fabian Pedregosa <f@bianp.net>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Manoj Kumar <manojkumarsivaraj334@gmail.com>
# Lars Buitinck
# Simon Wu <s8wu@uwaterloo.ca>
im... | bsd-3-clause |
pizzathief/numpy | doc/example.py | 51 | 3578 | """This is the docstring for the example.py module. Modules names should
have short, all-lowercase names. The module name may have underscores if
this improves readability.
Every module should have a docstring at the very top of the file. The
module's docstring may extend over multiple lines. If your docstring doe... | bsd-3-clause |
boland1992/seissuite_iran | build/lib/ambient/ant/pstomo.py | 2 | 62674 | """
Definition of classes handling dispersion curves and
velocity maps (obtained by inverting dispersion curves)
"""
import pserrors, psutils
import itertools as it
import numpy as np
from scipy.optimize import curve_fit
from scipy.interpolate import interp1d
import os
import glob
import pickle
import matplotlib.pyplo... | gpl-3.0 |
Lawrence-Liu/scikit-learn | examples/mixture/plot_gmm.py | 248 | 2817 | """
=================================
Gaussian Mixture Model Ellipsoids
=================================
Plot the confidence ellipsoids of a mixture of two Gaussians with EM
and variational Dirichlet process.
Both models have access to five components with which to fit the
data. Note that the EM model will necessari... | bsd-3-clause |
giorgiop/scikit-learn | sklearn/model_selection/_split.py | 7 | 61646 | """
The :mod:`sklearn.model_selection._split` module includes classes and
functions to split the data based on a preset strategy.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>,
# Olivier Grisel <olivier.grisel@ensta.org>
# Ragha... | bsd-3-clause |
rs2/pandas | pandas/core/indexers.py | 1 | 14164 | """
Low-dependency indexing utilities.
"""
import warnings
import numpy as np
from pandas._typing import Any, AnyArrayLike
from pandas.core.dtypes.common import (
is_array_like,
is_bool_dtype,
is_extension_array_dtype,
is_integer,
is_integer_dtype,
is_list_like,
)
from pandas.core.dtypes.gene... | bsd-3-clause |
jmmease/pandas | pandas/tests/plotting/test_frame.py | 3 | 119068 | # coding: utf-8
""" Test cases for DataFrame.plot """
import pytest
import string
import warnings
from datetime import datetime, date
import pandas as pd
from pandas import (Series, DataFrame, MultiIndex, PeriodIndex, date_range,
bdate_range)
from pandas.core.dtypes.api import is_list_like
from ... | bsd-3-clause |
chrisburr/scikit-learn | sklearn/manifold/tests/test_spectral_embedding.py | 26 | 9488 | from nose.tools import assert_true
from nose.tools import assert_equal
from scipy.sparse import csr_matrix
from scipy.sparse import csc_matrix
from scipy.linalg import eigh
import numpy as np
from numpy.testing import assert_array_almost_equal
from nose.tools import assert_raises
from nose.plugins.skip import SkipTes... | bsd-3-clause |
sodafree/backend | build/ipython/docs/examples/parallel/dagdeps.py | 6 | 3566 | """Example for generating an arbitrary DAG as a dependency map.
This demo uses networkx to generate the graph.
Authors
-------
* MinRK
"""
import networkx as nx
from random import randint, random
from IPython import parallel
def randomwait():
import time
from random import random
time.sleep(random())
... | bsd-3-clause |
asoliveira/NumShip | scripts/plot/r-velo-r-zz-plt.py | 1 | 3085 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#É adimensional?
adi = False
#É para salvar as figuras(True|False)?
save = True
#Caso seja para salvar, qual é o formato desejado?
formato = 'jpg'
#Caso seja para salvar, qual é o diretório que devo salvar?
dircg = 'fig-sen'
#Caso seja para salvar, qual é o nome do arquivo... | gpl-3.0 |
openego/data_processing | preprocessing/python_scripts/renpass_gis/gitgeojson.py | 2 | 1489 | #!/bin/python
# -*- coding: utf-8 -*-
"""
Database dump CSV-file with lon/lat is converted to a git compatible geojson
format.
Attributes
----------
infile : str
File path to database dump.
outfile : str
File path to geojson file.
Notes
-----
Dump has to match geojson keys title, description, lon and lat.
""... | agpl-3.0 |
ogvalt/saturn | spiking_som.py | 1 | 18544 |
from brian2 import *
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
import matplotlib.pyplot as plt
from dataset import ArtificialDataSet
class ReceptiveField:
# Parameter that used in standard deviation definition
gamma = 1.5
def __init__(self, bank_size=10, I_min=0... | mit |
louisLouL/pair_trading | capstone_env/lib/python3.6/site-packages/matplotlib/tests/test_backend_pdf.py | 2 | 6994 | # -*- encoding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import io
import os
import tempfile
import pytest
import numpy as np
from matplotlib import checkdep_usetex, cm, rcParams
from matplotlib.backends.backend_pdf import Pdf... | mit |
miguelzuma/montepython_zuma | montepython/analyze.py | 1 | 95056 | """
.. module:: analyze
:synopsis: Extract data from chains and produce plots
.. moduleauthor:: Karim Benabed <benabed@iap.fr>
.. moduleauthor:: Benjamin Audren <benjamin.audren@epfl.ch>
Collection of functions needed to analyze the Markov chains.
This module defines as well a class :class:`Information`, that sto... | mit |
budnyjj/bsuir_magistracy | disciplines/OTOS/lab_1/lab.py | 1 | 1813 | #!/usr/bin/env python
import functools
import math
import random
import numpy as np
import matplotlib.pyplot as plt
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
# 1D model
def model(x):
a = 2.7; d = 0.1; y_0 = 2
sigma = 0.001
result = y_0 - 0.04 * (x - a) - d * (x - a)**2
return resul... | gpl-3.0 |
alvarofierroclavero/scikit-learn | sklearn/kernel_ridge.py | 155 | 6545 | """Module :mod:`sklearn.kernel_ridge` implements kernel ridge regression."""
# Authors: Mathieu Blondel <mathieu@mblondel.org>
# Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# License: BSD 3 clause
import numpy as np
from .base import BaseEstimator, RegressorMixin
from .metrics.pairwise import pairwise... | bsd-3-clause |
VUEG/bdes_to | src/03_post_processing/similarity.py | 1 | 18175 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Functions and utilities comparing raster and vector similarities.
Module can be used alone or as part of Snakemake workflow.
"""
import logging
import rasterio
import geopandas as gpd
import pandas as pd
import numpy as np
import numpy.ma as ma
from importlib.machine... | mit |
tawsifkhan/scikit-learn | sklearn/tree/tree.py | 113 | 34767 | """
This module gathers tree-based methods, including decision, regression and
randomized trees. Single and multi-output problems are both handled.
"""
# Authors: Gilles Louppe <g.louppe@gmail.com>
# Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Brian Holt <bdholt1@gmail.com>
# Noel Da... | bsd-3-clause |
AlexGidiotis/Multimodal-Gesture-Recognition-with-LSTMs-and-CTC | multimodal_fusion/sequence_decoding.py | 1 | 3585 |
import pandas as pd
import numpy as np
from operator import itemgetter
from itertools import groupby
from keras.preprocessing import sequence
from keras.models import Sequential
from keras.models import model_from_json
from keras import backend as K
from keras.optimizers import RMSprop
import keras.callbacks
from kera... | mit |
juharris/tensorflow | tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py | 2 | 43185 | # 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 |
PrashntS/scikit-learn | sklearn/decomposition/tests/test_incremental_pca.py | 297 | 8265 | """Tests for Incremental PCA."""
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_raises
from sklearn import datasets
from sklearn.decomposition import PCA, IncrementalPCA
iris = datasets.load... | bsd-3-clause |
u3099811/BaxterTictacToe | src/baxter_interface/src/joint_trajectory_action/bezier.py | 3 | 13110 | #! /usr/bin/python
# Software License Agreement (BSD License)
#
# Copyright (c) 2013-2015, Rethink Robotics
# All rights reserved.
#
# Copyright (c) 2011, Ian McMahon
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following c... | apache-2.0 |
jdavidrcamacho/Tests_GP | 08 - Thesis results/speed_test6.py | 1 | 5414 | import Gedi as gedi
import george
import numpy as np;
import matplotlib.pylab as pl; pl.close('all')
from time import time,sleep
import scipy.optimize as op
import sys
##### INITIAL DATA ###########################################################
nrep = 1
pontos=[]
temposQP=[]
temposmulti=[]
georgeQP=[]
sleept... | mit |
sujithvm/internationality-journals | src/get_journal_list_Aminer.py | 3 | 1586 | __author__ = 'Sukrit'
import bson
import pandas as pd
import numpy as np
#import matplotlib.pyplot as plt
#from scipy.optimize import curve_fit
ELElist = []
with open('../data/Elsevier_journal_list.csv', 'r') as file :
x = file.readlines()
for line in x :
#print line
line = line.replace('&','a... | mit |
roverdotcom/pandastream-tools | sync_profiles.py | 1 | 3938 | import logging
import json
import argparse
from ConfigParser import SafeConfigParser
import panda
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
logger = logging.getLogger('requests.packages.urllib3')
logger.setLevel(logging.DEBUG)
logger.propagate = True
class ServiceError(Exception):
pass
... | mit |
hainm/scikit-learn | examples/linear_model/plot_ols.py | 220 | 1940 | #!/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 |
cbertinato/pandas | pandas/tests/indexes/timedeltas/test_scalar_compat.py | 1 | 2391 | """
Tests for TimedeltaIndex methods behaving like their Timedelta counterparts
"""
import numpy as np
import pytest
import pandas as pd
from pandas import Index, Series, Timedelta, TimedeltaIndex, timedelta_range
import pandas.util.testing as tm
class TestVectorizedTimedelta:
def test_tdi_total_seconds(self):
... | bsd-3-clause |
depet/scikit-learn | sklearn/decomposition/pca.py | 1 | 20538 | """ Principal Component Analysis
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Denis A. Engemann <d.engemann@fz-juelich.de>
#
# License: BSD 3 clause
from math import log, sqrt
import warnin... | bsd-3-clause |
gef756/statsmodels | statsmodels/stats/tests/test_panel_robustcov.py | 34 | 2750 | # -*- coding: utf-8 -*-
"""Test for panel robust covariance estimators after pooled ols
this follows the example from xtscc paper/help
Created on Tue May 22 20:27:57 2012
Author: Josef Perktold
"""
from statsmodels.compat.python import range, lmap
import numpy as np
from numpy.testing import assert_almost_equal
fro... | bsd-3-clause |
MagnusS/mirage-bench | test-jitsu/plot.py | 1 | 1208 | #!/usr/bin/env python
import sys
print "# Creating graphs from stdin (requires matplotlib)"
results = {}
for filename in sys.argv[1:]:
results[filename] = []
with open(filename) as f:
for l in f:
line = l.strip()
if len(line) == 0 or line[0] == '#':
continue
if l[0] == "!":
print "Warning: Some ... | isc |
pravsripad/mne-python | mne/inverse_sparse/mxne_optim.py | 5 | 55953 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Daniel Strohmeier <daniel.strohmeier@gmail.com>
# Mathurin Massias <mathurin.massias@gmail.com>
# License: Simplified BSD
import functools
from math import sqrt
import numpy as np
from .mxne_debiasing import compute_bias
from ..utils import... | bsd-3-clause |
xuewei4d/scikit-learn | sklearn/metrics/cluster/_unsupervised.py | 9 | 13917 | """Unsupervised evaluation metrics."""
# Authors: Robert Layton <robertlayton@gmail.com>
# Arnaud Fouchet <foucheta@gmail.com>
# Thierry Guillemot <thierry.guillemot.work@gmail.com>
# License: BSD 3 clause
import functools
import numpy as np
from ...utils import check_random_state
from ...utils i... | bsd-3-clause |
cpcloud/ibis | ibis/pandas/execution/tests/test_join.py | 1 | 13150 | import pandas as pd
import pandas.util.testing as tm
import pytest
from pytest import param
import ibis
import ibis.common.exceptions as com
pytestmark = pytest.mark.pandas
join_type = pytest.mark.parametrize(
'how',
[
'inner',
'left',
'right',
'outer',
param(
... | apache-2.0 |
schets/scikit-learn | sklearn/datasets/tests/test_samples_generator.py | 67 | 14842 | from __future__ import division
from collections import defaultdict
from functools import partial
import numpy as np
from sklearn.externals.six.moves import zip
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_almost_equal
fr... | bsd-3-clause |
fredhusser/scikit-learn | examples/calibration/plot_calibration_curve.py | 225 | 5903 | """
==============================
Probability Calibration curves
==============================
When performing classification one often wants to predict not only the class
label, but also the associated probability. This probability gives some
kind of confidence on the prediction. This example demonstrates how to di... | bsd-3-clause |
0x0all/scikit-learn | sklearn/manifold/tests/test_mds.py | 324 | 1862 | import numpy as np
from numpy.testing import assert_array_almost_equal
from nose.tools import assert_raises
from sklearn.manifold import mds
def test_smacof():
# test metric smacof using the data of "Modern Multidimensional Scaling",
# Borg & Groenen, p 154
sim = np.array([[0, 5, 3, 4],
... | bsd-3-clause |
mworks/mworks | examples/Examples/FindTheCircle/analysis/Python/selection_counts.py | 1 | 1241 | import sys
from matplotlib import pyplot
import numpy
sys.path.insert(0, '/Library/Application Support/MWorks/Scripting/Python')
from mworks.data import MWKFile
def selection_counts(filename):
with MWKFile(filename) as f:
r_codec = f.reverse_codec
red_code = r_codec['red_selected']
green... | mit |
aetilley/scikit-learn | sklearn/utils/graph.py | 289 | 6239 | """
Graph utilities and algorithms
Graphs are represented with their adjacency matrices, preferably using
sparse matrices.
"""
# Authors: Aric Hagberg <hagberg@lanl.gov>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Jake Vanderplas <vanderplas@astro.washington.edu>
# License: BSD 3 clause
impo... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.