repo_name stringlengths 7 90 | path stringlengths 5 191 | copies stringlengths 1 3 | size stringlengths 4 6 | content stringlengths 976 581k | license stringclasses 15
values |
|---|---|---|---|---|---|
wary/zeppelin | interpreter/lib/python/backend_zinline.py | 61 | 11831 | # 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 use ... | apache-2.0 |
mscross/pysplit | setup.py | 1 | 4309 | #! /usr/bin/env python
descr = """PySPLIT (a.k.a. `pysplit`): HYSPLIT Toolbox for Python.
This package is designed to be used with the desktop version of NOAA Air
Research Laboratory's HYSPLIT model (https://ready.arl.noaa.gov/HYSPLIT.php).
PySPLIT contains functions and classes ready to work with HYSPLIT to
automati... | bsd-3-clause |
altairpearl/scikit-learn | sklearn/linear_model/randomized_l1.py | 25 | 24850 | """
Randomized Lasso/Logistic: feature selection based on Lasso and
sparse Logistic Regression
"""
# Author: Gael Varoquaux, Alexandre Gramfort
#
# License: BSD 3 clause
import itertools
from abc import ABCMeta, abstractmethod
import warnings
import numpy as np
from scipy.sparse import issparse
from scipy import spar... | bsd-3-clause |
DOV-Vlaanderen/pydov | pydov/util/query.py | 1 | 3477 | # -*- coding: utf-8 -*-
"""Module containing extra query classes to build attribute search queries."""
from owslib.fes import OgcExpression, Or, PropertyIsEqualTo
class PropertyInList(OgcExpression):
"""Filter expression to test whether a given property has one of the
values from a list.
Internally tran... | mit |
rethore/FUSED-Wake | fusedwake/sdwm/DWM_misc.py | 1 | 3249 | # -*- coding: utf-8 -*-
""" Misc functions from variable sources
@moduleauthor:: Ewan Machefaux <ewan.machefaux@gmail.com>
"""
import numpy as np
from scipy.interpolate import interp1d
from scipy.integrate import quad
import pandas as pd
def LoadOutputs(folder,vWD,WF,WS,TI):
""" Functions used to load the binary ... | agpl-3.0 |
mjgrav2001/scikit-learn | benchmarks/bench_sample_without_replacement.py | 397 | 8008 | """
Benchmarks for sampling without replacement of integer.
"""
from __future__ import division
from __future__ import print_function
import gc
import sys
import optparse
from datetime import datetime
import operator
import matplotlib.pyplot as plt
import numpy as np
import random
from sklearn.externals.six.moves i... | bsd-3-clause |
ajm/pulp | pulp_simulator2.py | 2 | 13604 | import sys
import numpy
import scipy
import json
import itertools
import random
import os
from sys import stderr, exit, argv
from scipy.sparse.linalg import spsolve
from sklearn.metrics.pairwise import euclidean_distances
from nltk.stem import SnowballStemmer
def load_data_sparse(prefix) :
return scipy.sparse.csr... | gpl-3.0 |
ChanChiChoi/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 |
sigurdurb/ru_canvas | gen_groupset_individual.py | 1 | 2926 | #!/usr/bin/python3
from canvasapi import Canvas
'''This imports the API_KEY and API_URL from the canvas_config.py file'''
from canvas_config import *
import pandas as pd
'''Course id is in your url; example: https://yourschool.instructure.com/courses/{Course_ID}'''
COURSE_ID = 254 # type int - a number like 254
'''... | mit |
MatthewDaggitt/AshCalc | desktop/frames/results_frame.py | 1 | 30433 | import math
import tkinter
from copy import deepcopy
from tkinter import messagebox
from tkinter.ttk import Frame, LabelFrame, Label, Button, Combobox, Separator
import numpy as np
from matplotlib import pyplot
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg as FigureCanvas
from mpl_toolkits.mplot3d im... | mit |
captiosus/treadmill | treadmill/api/scheduler.py | 1 | 1565 | """Implementation of scheduler reports API.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import fnmatch
import io
import kazoo
import pandas as pd
from treadmill import authz
from treadmill import context
fro... | apache-2.0 |
akrherz/iem | htdocs/plotting/auto/scripts/p52.py | 1 | 5197 | """Wfo Gantt chart"""
import datetime
import pytz
from pandas.io.sql import read_sql
import matplotlib.dates as mdates
from matplotlib import ticker
from pyiem.nws import vtec
from pyiem.plot import figure
from pyiem.util import get_autoplot_context, get_dbconn
from pyiem.exceptions import NoDataFound
def get_descri... | mit |
gevero/deap | doc/conf.py | 9 | 8166 | # -*- coding: utf-8 -*-
#
# DEAP documentation build configuration file, created by
# sphinx-quickstart on Sat Jan 30 13:21:43 2010.
#
# 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 file.
#
# All co... | lgpl-3.0 |
sarahgrogan/scikit-learn | examples/ensemble/plot_adaboost_twoclass.py | 347 | 3268 | """
==================
Two-class AdaBoost
==================
This example fits an AdaBoosted decision stump on a non-linearly separable
classification dataset composed of two "Gaussian quantiles" clusters
(see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision
boundary and decision scores. The di... | bsd-3-clause |
nkmk/python-snippets | notebook/pandas_multiindex_indexing.py | 1 | 9706 | import pandas as pd
df = pd.read_csv('data/src/sample_multi.csv', index_col=[0, 1, 2])
print(df)
# val_1 val_2
# level_1 level_2 level_3
# A0 B0 C0 98 90
# C1 44 9
# B1 C2 39 17
# C3 ... | mit |
cauchycui/scikit-learn | sklearn/feature_extraction/tests/test_text.py | 75 | 34122 | from __future__ import unicode_literals
import warnings
from sklearn.feature_extraction.text import strip_tags
from sklearn.feature_extraction.text import strip_accents_unicode
from sklearn.feature_extraction.text import strip_accents_ascii
from sklearn.feature_extraction.text import HashingVectorizer
from sklearn.fe... | bsd-3-clause |
simo-tuomisto/portfolio | Statistical Methods 2014 - Home exam/Code/exam_p02.py | 1 | 5524 | import numpy as np
import string
import random
import matplotlib.pyplot as mpl
class Passenger:
def __init__(self, rowNumber, seatLetter):
self.rowNumber = float(rowNumber)
self.seatLetter = seatLetter
self.hasWaited = False
def checkPosition(self, position):
return position == self.rowNumber
def __re... | mit |
vex1023/vxTrader | vxTrader/broker/xqTrader.py | 1 | 15946 | # encoding=utf-8
'''
雪球web交易接口
'''
import time
import demjson as json
import pandas as pd
import requests
import six
from vxTrader import logger
from vxTrader.TraderException import TraderAPIError
from vxTrader.broker.WebTrader import WebTrader, LoginSession, BrokerFactory
_BASE_MULTIPE = 1000000.00
_HEADERS = {
... | mit |
marionleborgne/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_qt.py | 69 | 16846 | from __future__ import division
import math
import os
import sys
import matplotlib
from matplotlib import verbose
from matplotlib.cbook import is_string_like, onetrue
from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
FigureManagerBase, FigureCanvasBase, NavigationToolbar2, cursors
from mat... | agpl-3.0 |
karstenw/nodebox-pyobjc | examples/Extended Application/matplotlib/examples/lines_bars_and_markers/line_styles_reference.py | 1 | 1630 | """
====================
Line-style reference
====================
Reference for line-styles included with Matplotlib.
"""
import numpy as np
import matplotlib.pyplot as plt
# nodebox section
if __name__ == '__builtin__':
# were in nodebox
import os
import tempfile
W = 800
inset = 20
size(W, 6... | mit |
geomagpy/MARTAS | oldstuff/UtilityScripts/testserial.py | 3 | 1861 | #!/usr/bin/env python
from __future__ import print_function
import sys, time, os, socket
import serial
import struct, binascii, re, csv
from datetime import datetime, timedelta
from matplotlib.dates import date2num, num2date
import numpy as np
import time
port = '/dev/ttyS0'
baudrate='115200'
eol = '\r'
def lineread... | gpl-3.0 |
Diviyan-Kalainathan/causal-humans | Cause-effect/lib/fonollosa/features.py | 1 | 29965 | """
Feature extraction
"""
# Author: Jose A. R. Fonollosa <jarfo@yahoo.com>
#
# License: Apache, Version 2.0
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.metrics import adjusted_mutual_info_score
from scipy.special import psi
from scipy.stats.stats import pearsonr
from scipy.stats import sk... | mit |
renesugar/arrow | python/pyarrow/tests/pandas_examples.py | 5 | 5149 | # -*- coding: utf-8 -*-
# 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
# "... | apache-2.0 |
yorkerlin/shogun | examples/undocumented/python_modular/graphical/so_multiclass_BMRM.py | 10 | 2835 | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from modshogun import RealFeatures
from modshogun import MulticlassModel, MulticlassSOLabels, RealNumber, DualLibQPBMSOSVM
from modshogun import BMRM, PPBMRM, P3BMRM
from modshogun import StructuredAccuracy
def fill_data(cnt, minv, maxv):
x1 =... | gpl-3.0 |
Carldeboer/BigWig-Tools | transformBigWig.py | 1 | 9716 | #!/broad/software/free/Linux/redhat_5_x86_64/pkgs/python_2.7.1-sqlite3-rtrees/bin/python2.7
#doesn't work with:
#!/home/unix/cgdeboer/bin/python3
import argparse
parser = argparse.ArgumentParser(description='This program takes a BW file as input and applies one or more provided mathematical operations to the data, in ... | gpl-2.0 |
devanshdalal/scikit-learn | sklearn/utils/tests/test_seq_dataset.py | 79 | 2497 | # Author: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org>
#
# License: BSD 3 clause
import numpy as np
from numpy.testing import assert_array_equal
import scipy.sparse as sp
from sklearn.utils.seq_dataset import ArrayDataset, CSRDataset
from sklearn.datasets import load_iris
from sklearn.utils.testing import assert_eq... | bsd-3-clause |
jmd-dk/concept | concept/tests/nprocs_pm/analyze.py | 1 | 4429 | # This file has to be run in pure Python mode!
# Imports from the CO𝘕CEPT code
from commons import *
from snapshot import load
import species
plt = get_matplotlib().pyplot
# Absolute path and name of the directory of this file
this_dir = os.path.dirname(os.path.realpath(__file__))
this_test = os.path.basename(this_... | gpl-3.0 |
cdr-stats/cdr-stats | cdr_stats/cdr/views.py | 1 | 38314 | #
# CDR-Stats License
# http://www.cdr-stats.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2015 Star2Billing S.L.
#
# The Initial Develope... | mpl-2.0 |
wlamond/scikit-learn | examples/cluster/plot_digits_agglomeration.py | 377 | 1694 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Feature agglomeration
=========================================================
These images how similar features are merged together using
feature agglomeration.
"""
print(__doc__)
# Code source: Gaël Varoquaux
#... | bsd-3-clause |
TaxIPP-Life/til-france | til_france/pgm/output/statistics.py | 1 | 2639 | '''
Created on 29 Apr 2013
@author: alexis_e
'''
from pandas import HDFStore, merge # DataFrame
import numpy as np
import pdb
import time
from utils import til_name_to_of
temps = time.clock()
simul = "C:/til/output/simul.h5"
# output = HDFStore(calc)
simul = HDFStore(simul)
nom = 'register'
base = 'entities/' + ... | gpl-3.0 |
Jordan-Zhu/RoboVision | main.py | 1 | 11953 | import cv2
import numpy as np
import scipy.io as sio
import settings
import matplotlib.pyplot as plt
import Line_feat_contours as lfc
import classify_curves as cc
import label_curves as lc
import merge_lines as merge_lines
import util as util
from edge_detect import edge_detect
from line_match import line_match
from li... | gpl-3.0 |
shyamalschandra/scikit-learn | sklearn/svm/setup.py | 321 | 3157 | import os
from os.path import join
import numpy
from sklearn._build_utils import get_blas_info
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('svm', parent_package, top_path)
config.add_subpackage('tests')
# Section L... | bsd-3-clause |
jakobworldpeace/scikit-learn | examples/mixture/plot_gmm.py | 122 | 3265 | """
=================================
Gaussian Mixture Model Ellipsoids
=================================
Plot the confidence ellipsoids of a mixture of two Gaussians
obtained with Expectation Maximisation (``GaussianMixture`` class) and
Variational Inference (``BayesianGaussianMixture`` class models with
a Dirichlet ... | bsd-3-clause |
andrew0harney/EEG-Multi-Channel-Utility | ExampleScripts/prepare.py | 1 | 2129 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from SignalManager import SignalManager
from signalUtils import longest_event,mask_inter_block_signal
import tables
#The script demonstrates the initial preperation of the SignalManager and useful functionality at this stage.
#The assumption here i... | mit |
itdxer/neupy | tests/storage/test_object_storage.py | 1 | 4137 | import tempfile
import dill
import numpy as np
from sklearn import datasets, preprocessing
from six.moves import cPickle as pickle
from neupy import algorithms, layers, init
from base import BaseTestCase
from helpers import catch_stdout
class BasicStorageTestCase(BaseTestCase):
def test_simple_dill_storage(sel... | mit |
tqdv/info-lstl | Info/TPs/2017-03-15.py | 1 | 2585 | from matplotlib.pyplot import plot , grid , show
from numpy import sqrt , exp , log as ln , sin , cos
from numpy import matrix , zeros
def Euler (F, t_0 , t_max , N, Y_0) :
h = ( t_max - t_0) / N
Y = matrix ( Y_0) ; TY = [ matrix (Y)]
t = t_0 ; T = [t]
for n in range (N) :
Y += h * F(Y... | gpl-3.0 |
cbpygit/pypmj | pypmj/materials.py | 1 | 24117 | # coding: utf8
"""Extension for setting material data or to read in and interpolate it from
appropriate data bases.
Authors : Carlo Barth
"""
# Let users know if they're missing any of our hard dependencies
# (this is section is copied from the pandas __init__.py)
hard_dependencies = ('parse', 'yaml')
missing_depen... | gpl-3.0 |
smartscheduling/scikit-learn-categorical-tree | sklearn/svm/tests/test_sparse.py | 15 | 12169 | from nose.tools import assert_raises, assert_true, assert_false
import numpy as np
from scipy import sparse
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal)
from sklearn import datasets, svm, linear_model, base
from sklearn.datasets import make_classif... | bsd-3-clause |
maminian/skewtools | scripts/animate_duct_flow_mc_projs_panels.py | 1 | 3929 | #!/usr/bin/python
import numpy as np
import pylab
from numpy import transpose,size,sqrt
import sys
import matplotlib.pyplot as pyplot
from matplotlib.pyplot import cla,hold
import matplotlib.animation as anim
import h5py
from matplotlib.colors import LogNorm
from mpl_toolkits.mplot3d import Axes3D
from matplotlib ... | gpl-3.0 |
nhejazi/scikit-learn | sklearn/decomposition/tests/test_nmf.py | 21 | 17922 | import numpy as np
import scipy.sparse as sp
import numbers
from scipy import linalg
from sklearn.decomposition import NMF, non_negative_factorization
from sklearn.decomposition import nmf # For testing internals
from scipy.sparse import csc_matrix
from sklearn.utils.testing import assert_true
from sklearn.utils.te... | bsd-3-clause |
arabenjamin/scikit-learn | sklearn/decomposition/__init__.py | 147 | 1421 | """
The :mod:`sklearn.decomposition` module includes matrix decomposition
algorithms, including among others PCA, NMF or ICA. Most of the algorithms of
this module can be regarded as dimensionality reduction techniques.
"""
from .nmf import NMF, ProjectedGradientNMF
from .pca import PCA, RandomizedPCA
from .incrementa... | bsd-3-clause |
jereze/scikit-learn | examples/classification/plot_classifier_comparison.py | 66 | 4895 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=====================
Classifier comparison
=====================
A comparison of a several classifiers in scikit-learn on synthetic datasets.
The point of this example is to illustrate the nature of decision boundaries
of different classifiers.
This should be taken with ... | bsd-3-clause |
justincassidy/scikit-learn | examples/ensemble/plot_adaboost_regression.py | 311 | 1529 | """
======================================
Decision Tree Regression with AdaBoost
======================================
A decision tree is boosted using the AdaBoost.R2 [1] algorithm on a 1D
sinusoidal dataset with a small amount of Gaussian noise.
299 boosts (300 decision trees) is compared with a single decision tr... | bsd-3-clause |
louispotok/pandas | pandas/tests/util/test_util.py | 1 | 17649 | # -*- coding: utf-8 -*-
import os
import locale
import codecs
import sys
from uuid import uuid4
from collections import OrderedDict
import pytest
from pandas.compat import intern, PY3
import pandas.core.common as com
from pandas.util._move import move_into_mutable_buffer, BadMove, stolenbuf
from pandas.util._decorator... | bsd-3-clause |
nbruns1/metaSMT | bindings/python/examples/graph_coloring.py | 4 | 1550 | #!/usr/bin/python
import random
import sys
sys.path.insert( 0, sys.path[0] + '/..' )
from metasmt.core import *
from metasmt.operators import *
from metasmt.support import *
import matplotlib.pyplot as plt
import networkx as nx
# Graph Coloring
def graph_coloring( G, num_colors,
solver = boolecto... | mit |
ChinmaiRaman/phys227-midterm | midterm.py | 1 | 1816 | #! /usr/bin/env python
"""
File: midterm.py
Copyright (c) 2016 Chinmai Raman
License: MIT
Course: PHYS227
Assignment: Midterm
Date: March 22, 2016
Email: raman105@mail.chapman.edu
Name: Chinmai Raman
Description: Midterm
"""
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
def seque... | mit |
shafferm/fast_sparCC | sparcc_fast/utils.py | 1 | 1984 | import numpy as np
import pandas as pd
__author__ = 'shafferm'
def sparcc_paper_filter(table):
"""if a observation averages more than 2 reads per sample then keep,
if a sample has more than 500 reads then keep"""
table = table[table.sum(axis=1) > 500]
table = table.loc[:, table.mean(axis=0) > 2]
... | bsd-3-clause |
Snazz2001/BDA_py_demos | demos_ch6/demo6_1.py | 19 | 2435 | """Bayesian Data Analysis, 3rd ed
Chapter 6, demo 1
Posterior predictive checking demo
"""
from __future__ import division
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
# edit default plot settings (colours from colorbrewer2.org)
plt.rc('font', size=14)
plt.rc('lines', color='#377eb8', ... | gpl-3.0 |
brvnl/master | parser/Returns.py | 1 | 3361 | import logging
from Calendar import Calendar
import pandas as pd
def ret(array):
return (array[-1]/array[0] - 1)
class MultiplicativeReturns(object):
def __init__(self, serie, bw=1, fw=0):
self.raw = serie.copy()
self.th_backward = bw
self.th_foward = fw
def process(self):
... | gpl-3.0 |
datapythonista/pandas | pandas/tests/extension/base/interface.py | 3 | 4115 | import numpy as np
from pandas.core.dtypes.common import is_extension_array_dtype
from pandas.core.dtypes.dtypes import ExtensionDtype
import pandas as pd
import pandas._testing as tm
from pandas.tests.extension.base.base import BaseExtensionTests
class BaseInterfaceTests(BaseExtensionTests):
"""Tests that the ... | bsd-3-clause |
Winand/pandas | pandas/tests/indexes/period/test_partial_slicing.py | 19 | 5909 | import pytest
import numpy as np
import pandas as pd
from pandas.util import testing as tm
from pandas import (Series, period_range, DatetimeIndex, PeriodIndex,
DataFrame, _np_version_under1p12, Period)
class TestPeriodIndex(object):
def setup_method(self, method):
pass
def tes... | bsd-3-clause |
equialgo/scikit-learn | examples/neighbors/plot_approximate_nearest_neighbors_scalability.py | 85 | 5728 | """
============================================
Scalability of Approximate Nearest Neighbors
============================================
This example studies the scalability profile of approximate 10-neighbors
queries using the LSHForest with ``n_estimators=20`` and ``n_candidates=200``
when varying the number of sa... | bsd-3-clause |
acorg/dark-matter | bin/proteins-to-pathogens.py | 1 | 11659 | #!/usr/bin/env python
"""
Read protein match output produced by noninteractive-alignment-panel.py and
group it by pathogen (either virus or bacteria).
This is currently only useful when you are matching against a subject protein
database whose titles have a pathogen name in square brackets, like this:
gi|820945251|r... | mit |
waynenilsen/statsmodels | statsmodels/examples/tut_ols_ancova.py | 33 | 2455 | '''Examples OLS
Note: uncomment plt.show() to display graphs
Summary:
========
Relevant part of construction of design matrix
xg includes group numbers/labels,
x1 is continuous explanatory variable
>>> dummy = (xg[:,None] == np.unique(xg)).astype(float)
>>> X = np.c_[x1, dummy[:,1:], np.ones(nsample)]
Estimate the... | bsd-3-clause |
cjbrasher/LipidFinder | LipidFinder/PeakFilter/InSrcFragRemoval.py | 1 | 8357 | # Copyright (c) 2019 J. Alvarez-Jarreta and C.J. Brasher
#
# This file is part of the LipidFinder software tool and governed by the
# 'MIT License'. Please see the LICENSE file that should have been
# included as part of this software.
"""Set of methods aimed to remove in-source fragments:
> remove_in_src_frags():
... | mit |
P1R/cinves | TrabajoFinal/tubo140cm/4-DpvsDist/DpvsDist-sinerror.py | 1 | 2071 | #!/usr/bin/env python2.7
import numpy as np
import matplotlib.pyplot as plt
Distancia=np.array([0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84])
T1i=np.array([23.3,23.6,23.7,24.0,24.1,24.3,24.3,24.2,24.2,24.5,24.1,24.3,24.8,24.5,24.6,24.8,25.0,24.7,24.9,25.0,25.1,25.2,25.3,25.1,25.4... | apache-2.0 |
hanteng/pyCHNadm1 | pyCHNadm1/02_converting_csv_pkl.py | 1 | 2853 | # -*- coding: utf-8 -*-
#歧視無邊,回頭是岸。鍵起鍵落,情真情幻。
import ConfigParser
Config = ConfigParser.ConfigParser()
Config.read("config.ini")
dir_src = Config.get("Directory",'source')
dir_out = Config.get("Directory",'outcome')
fn_suffix = Config.get("Filename",'suffix')
fn_datasrc= Config.get("Filename",'datasource')
fn_mappi... | gpl-3.0 |
nmartensen/pandas | pandas/tests/indexing/test_categorical.py | 5 | 17421 | # -*- coding: utf-8 -*-
import pytest
import pandas as pd
import numpy as np
from pandas import (Series, DataFrame, Timestamp,
Categorical, CategoricalIndex)
from pandas.util.testing import assert_series_equal, assert_frame_equal
from pandas.util import testing as tm
class TestCategoricalIndex(o... | bsd-3-clause |
baldwint/circa | setup.py | 1 | 1349 | from setuptools import setup
# dependencies
reqs = ['numpy', 'PyDAQmx', 'matplotlib', 'pyvisa']
# we also need wxPython, but pip cannot install this
extras = {}
# http://stackoverflow.com/a/7071358/735926
import re
VERSIONFILE = 'circa/__init__.py'
verstrline = open(VERSIONFILE, 'rt').read()
VSRE = r'^__version__\s+=... | mit |
xzh86/scikit-learn | sklearn/preprocessing/tests/test_function_transformer.py | 176 | 2169 | from nose.tools import assert_equal
import numpy as np
from sklearn.preprocessing import FunctionTransformer
def _make_func(args_store, kwargs_store, func=lambda X, *a, **k: X):
def _func(X, *args, **kwargs):
args_store.append(X)
args_store.extend(args)
kwargs_store.update(kwargs)
... | bsd-3-clause |
ryandougherty/mwa-capstone | MWA_Tools/build/matplotlib/lib/mpl_examples/axes_grid/demo_curvelinear_grid.py | 16 | 4116 | import numpy as np
#from matplotlib.path import Path
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
from mpl_toolkits.axisartist.grid_helper_curvelinear import GridHelperCurveLinear
from mpl_toolkits.axisartist import Subplot
from mpl_toolkits.axisartist import SubplotHost, \
ParasiteAxesAuxT... | gpl-2.0 |
rafaelcgs10/PIM_Fourier | exemplo_fourier.py | 1 | 4180 | import cv2
import numpy as np
from matplotlib import pyplot as plt
nome='insetoGray.png' #'..\horizontais.jpg' #'folhas1.jpg' #'32530-large.jpg'#'lenaShort.jpg'#
img = cv2.imread(nome,0)
(h,l)=np.shape(img)
f = np.fft.fft2(img)
fshift = np.fft.fftshift(f)
magnitude_spectrum_shifted = 20*np.log(np.abs(fshift... | gpl-2.0 |
merfishtools/merfishtools-evaluation | scripts/plot-go-enrichment.py | 1 | 1107 | import matplotlib
matplotlib.use("agg")
import matplotlib.pyplot as plt
import networkx as nx
from networkx.algorithms import bipartite
import pandas as pd
import seaborn as sns
terms = pd.read_table(snakemake.input.terms, index_col=0)
genes = pd.read_table(snakemake.input.genes)
genes.index = genes["goterm"]
terms ... | mit |
friedmud/libmesh | doc/statistics/cloc_libmesh.py | 1 | 8012 | #!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import math
# Import stuff for working with dates
from datetime import datetime
from matplotlib.dates import date2num
# git checkout `git rev-list -n 1 --before="$my_date" master`
# cloc.pl src/*/*.C include/*/*.h
data = [
# 2003 - All data fro... | lgpl-2.1 |
imperial-genomics-facility/data-management-python | igf_data/utils/project_data_display_utils.py | 1 | 8491 | import os
import pandas as pd
from igf_data.utils.seqrunutils import get_seqrun_date_from_igf_id
def _count_total_reads(data,seqrun_list):
'''
An internal function for counting total reads
required params:
:param data, A dictionary containing seqrun ids a key an read counts as values
:param seqrun_list, ... | apache-2.0 |
elijah513/scikit-learn | sklearn/neural_network/rbm.py | 206 | 12292 | """Restricted Boltzmann Machine
"""
# Authors: Yann N. Dauphin <dauphiya@iro.umontreal.ca>
# Vlad Niculae
# Gabriel Synnaeve
# Lars Buitinck
# License: BSD 3 clause
import time
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator
from ..base import TransformerMixi... | bsd-3-clause |
UNR-AERIAL/scikit-learn | examples/svm/plot_iris.py | 225 | 3252 | """
==================================================
Plot different SVM classifiers in the iris dataset
==================================================
Comparison of different linear SVM classifiers on a 2D projection of the iris
dataset. We only consider the first 2 features of this dataset:
- Sepal length
- Se... | bsd-3-clause |
vigilv/scikit-learn | benchmarks/bench_mnist.py | 76 | 6136 | """
=======================
MNIST dataset benchmark
=======================
Benchmark on the MNIST dataset. The dataset comprises 70,000 samples
and 784 features. Here, we consider the task of predicting
10 classes - digits from 0 to 9 from their raw images. By contrast to the
covertype dataset, the feature space is... | bsd-3-clause |
ChanderG/scikit-learn | sklearn/tests/test_grid_search.py | 68 | 28778 | """
Testing for grid search module (sklearn.grid_search)
"""
from collections import Iterable, Sized
from sklearn.externals.six.moves import cStringIO as StringIO
from sklearn.externals.six.moves import xrange
from itertools import chain, product
import pickle
import sys
import numpy as np
import scipy.sparse as sp
... | bsd-3-clause |
NREL/OpenWARP | Contest_Output/Test_Case_Implementations/Part1/source/automated_test/bemio/data_structures/bem.py | 6 | 25995 | # Copyright 2014 the National Renewable Energy Laboratory
# 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... | apache-2.0 |
RPGOne/Skynet | imbalanced-learn-master/imblearn/ensemble/balance_cascade.py | 1 | 13919 | """Class to perform under-sampling using balace cascade."""
from __future__ import print_function
import numpy as np
from sklearn.utils import check_random_state
from ..base import SamplerMixin
ESTIMATOR_KIND = ('knn', 'decision-tree', 'random-forest', 'adaboost',
'gradient-boosting', 'linear-svm... | bsd-3-clause |
DanielAndreasen/ObservationTools | visibility.py | 2 | 30628 | # -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import numpy as np
import datetime as dt
from dateutil import tz
import pickle
from random import choice
from PyAstronomy import pyasl
from astropy.coordinates import SkyCoord
from astropy.coordinates import name_resolve
import ephem
import argpar... | mit |
GeraldLoeffler/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_wx.py | 69 | 77038 | from __future__ import division
"""
backend_wx.py
A wxPython backend for matplotlib, based (very heavily) on
backend_template.py and backend_gtk.py
Author: Jeremy O'Donoghue (jeremy@o-donoghue.com)
Derived from original copyright work by John Hunter
(jdhunter@ace.bsd.uchicago.edu)
Copyright (C) Jeremy O'Don... | agpl-3.0 |
APMonitor/applications | scheduling_and_control/model_mismatch/time_scaled/control.py | 1 | 3688 | from APMonitor import *
import numpy as np
if True:
K_mesh = np.load('K_mesh.npy')
tau_mesh = np.load('tau_mesh.npy')
obj = np.load('obj.npy')
else:
s = 'http://127.0.0.1'
a = 'mismatch'
# optimize at mesh points
K = np.arange(0.2, 3.0, 0.1) # 0.1
tau = np.arange(0... | apache-2.0 |
hobson/pug-invest | pug/invest/gof.py | 1 | 1728 | """GOF = Goodness of Fit metric
Examples:
>>> rmse([1,2,3,4], [4,5,6,7])
2
>>> log_loss([[0, 1],[0, 1]], [[.6,.4],[.25,.75]]) # doctest: +ELLIPSIS
1.20397...
>>> llfun([[0, 1],[0, 1]], [[.6,.4],[.25,.75]]) # doctest: +ELLIPSIS
1.20397...
>>> metrics.log_loss([1,1], [[.6,.4],[.25,.75]]) # doctest: +ELL... | mit |
agentfog/qiime | scripts/identify_paired_differences.py | 15 | 9191 | #!/usr/bin/env python
# File created on 19 Jun 2013
from __future__ import division
__author__ = "Greg Caporaso"
__copyright__ = "Copyright 2013, The QIIME project"
__credits__ = ["Greg Caporaso", "Jose Carlos Clemente Litran"]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__maintainer__ = "Greg Caporaso"
__email__ = ... | gpl-2.0 |
dr-nate/msmbuilder | docs/figures/kde-vs-histogram.py | 12 | 1119 | import numpy as np
import matplotlib.pyplot as pp
from scipy.stats import norm
from sklearn.neighbors import KernelDensity
#----------------------------------------------------------------------
# Plot the progression of histograms to kernels
N = 100
np.random.seed(1)
X = np.concatenate((np.random.normal(0, 1, 0.3 * ... | lgpl-2.1 |
terna/SLAPP3 | 6 objectSwarmObserverAgents_AESOP_turtleLib_NetworkX/oligopoly/parameters.py | 1 | 20359 | # parameters.py
import myGauss
from Tools import *
import commonVar as common
import networkx as nx
import matplotlib as mplt
import numpy.random as npr
import pandas as pd
from IPython import get_ipython
import pandas as pd
import numpy as np
import sys
def fInput(label):
x = ""
while x=="" or " " in x:
... | cc0-1.0 |
TomAugspurger/pandas | pandas/tests/indexing/multiindex/test_chaining_and_caching.py | 1 | 1979 | import numpy as np
import pytest
from pandas import DataFrame, MultiIndex, Series
import pandas._testing as tm
import pandas.core.common as com
def test_detect_chained_assignment():
# Inplace ops, originally from:
# https://stackoverflow.com/questions/20508968/series-fillna-in-a-multiindex-dataframe-does-not... | bsd-3-clause |
rsivapr/scikit-learn | sklearn/cluster/__init__.py | 8 | 1048 | """
The :mod:`sklearn.cluster` module gathers popular unsupervised clustering
algorithms.
"""
from .spectral import spectral_clustering, SpectralClustering
from .mean_shift_ import mean_shift, MeanShift, estimate_bandwidth, \
get_bin_seeds
from .affinity_propagation_ import affinity_propagation, AffinityPropagatio... | bsd-3-clause |
timvandermeij/sentiment-analysis | plot.py | 1 | 7184 | import sys
import os
import json
import numpy as np
import pandas as pd
from collections import OrderedDict
from math import factorial
import matplotlib
# Make it possible to run matplotlib in SSH
NO_DISPLAY = 'DISPLAY' not in os.environ or os.environ['DISPLAY'] == ''
if NO_DISPLAY:
matplotlib.use('Agg')
else:
... | mit |
mworles/capstone_one | src/models/ml_test.py | 1 | 7350 | import pandas as pd
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import f1_score, accuracy_score, \
precision_score, recall_score, roc_auc_score
from sklearn.preprocessing import StandardScaler
# set data directory locat... | bsd-3-clause |
theoryno3/scikit-learn | benchmarks/bench_20newsgroups.py | 377 | 3555 | from __future__ import print_function, division
from time import time
import argparse
import numpy as np
from sklearn.dummy import DummyClassifier
from sklearn.datasets import fetch_20newsgroups_vectorized
from sklearn.metrics import accuracy_score
from sklearn.utils.validation import check_array
from sklearn.ensemb... | bsd-3-clause |
pycrystem/pycrystem | pyxem/utils/pixelated_stem_tools.py | 1 | 17959 | # -*- coding: utf-8 -*-
# Copyright 2016-2020 The pyXem developers
#
# This file is part of pyXem.
#
# pyXem 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 of the License, or
# (at your optio... | gpl-3.0 |
mbayon/TFG-MachineLearning | vbig/lib/python2.7/site-packages/sklearn/metrics/cluster/supervised.py | 13 | 31406 | """Utilities to evaluate the clustering performance of models.
Functions named as *_score return a scalar value to maximize: the higher the
better.
"""
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Wei LI <kuantkid@gmail.com>
# Diego Molla <dmolla-aliod@gmail.com>
# Arnaud Fouchet ... | mit |
harisbal/pandas | pandas/core/tools/numeric.py | 5 | 6032 | import numpy as np
import pandas as pd
from pandas.core.dtypes.common import (
is_scalar,
is_numeric_dtype,
is_decimal,
is_datetime_or_timedelta_dtype,
is_number,
ensure_object)
from pandas.core.dtypes.generic import ABCSeries, ABCIndexClass
from pandas.core.dtypes.cast import maybe_downcast_to_... | bsd-3-clause |
appapantula/scikit-learn | examples/plot_digits_pipe.py | 250 | 1809 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Pipelining: chaining a PCA and a logistic regression
=========================================================
The PCA does an unsupervised dimensionality reduction, while the logistic
regression does the predictio... | bsd-3-clause |
fzheng/codejam | lib/python2.7/site-packages/IPython/testing/iptestcontroller.py | 14 | 18314 | # -*- coding: utf-8 -*-
"""IPython Test Process Controller
This module runs one or more subprocesses which will actually run the IPython
test suite.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import argparse
import ... | mit |
larsmans/scikit-learn | doc/tutorial/text_analytics/solutions/exercise_01_language_train_model.py | 254 | 2253 | """Build a language detector model
The goal of this exercise is to train a linear classifier on text features
that represent sequences of up to 3 consecutive characters so as to be
recognize natural languages by using the frequencies of short character
sequences as 'fingerprints'.
"""
# Author: Olivier Grisel <olivie... | bsd-3-clause |
ChanChiChoi/scikit-learn | sklearn/datasets/tests/test_rcv1.py | 322 | 2414 | """Test the rcv1 loader.
Skipped if rcv1 is not already downloaded to data_home.
"""
import errno
import scipy.sparse as sp
import numpy as np
from sklearn.datasets import fetch_rcv1
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing i... | bsd-3-clause |
robbymeals/scikit-learn | sklearn/decomposition/dict_learning.py | 83 | 44062 | """ Dictionary learning
"""
from __future__ import print_function
# Author: Vlad Niculae, Gael Varoquaux, Alexandre Gramfort
# License: BSD 3 clause
import time
import sys
import itertools
from math import sqrt, ceil
import numpy as np
from scipy import linalg
from numpy.lib.stride_tricks import as_strided
from ..b... | bsd-3-clause |
kapteyn-astro/kapteyn | doc/source/EXAMPLES/kmpfit_Pearsonsdata.py | 1 | 5463 | #!/usr/bin/env python
#------------------------------------------------------------
# Purpose: Program to best fit straight line parameters
# to data given by Pearson, 1901
# Vog, 12 Dec, 2011
#
# The data for x and y are from Pearson
# Pearson, K. 1901. On lines and planes of closest fit to systems
# of poin... | bsd-3-clause |
jjbrin/trading-with-python | historicDataDownloader/historicDataDownloader.py | 77 | 4526 | '''
Created on 4 aug. 2012
Copyright: Jev Kuznetsov
License: BSD
a module for downloading historic data from IB
'''
import ib
import pandas
from ib.ext.Contract import Contract
from ib.opt import ibConnection, message
from time import sleep
import tradingWithPython.lib.logger as logger
from pandas impor... | bsd-3-clause |
pllim/astropy | astropy/tests/helper.py | 2 | 17287 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module provides the tools used to internally run the astropy test suite
from the installed astropy. It makes use of the `pytest`_ testing framework.
"""
import os
import sys
import types
import pickle
import warnings
import functools
import pyte... | bsd-3-clause |
joshloyal/scikit-learn | sklearn/preprocessing/tests/test_data.py | 30 | 61609 |
# Authors:
#
# Giorgio Patrini
#
# License: BSD 3 clause
import warnings
import numpy as np
import numpy.linalg as la
from scipy import sparse
from distutils.version import LooseVersion
from sklearn.utils import gen_batches
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing im... | bsd-3-clause |
NINAnor/sentinel4nature | Tree canopy cover/regression/GBRT_Dovre2_manual_NNLS.py | 1 | 9107 | # GBRT for Dovre2 case study site
# Training data: manually digitized training areas, including water pixels
# Predictors: results of NNLS spectral unmixing
# Authors: Stefan Blumentrath
import numpy as np
import matplotlib
matplotlib.use('Cairo') # Must be before importing matplotlib.pyplot or pylab!
import matplotli... | gpl-2.0 |
HolgerPeters/scikit-learn | sklearn/metrics/cluster/tests/test_supervised.py | 34 | 10313 | import numpy as np
from sklearn.metrics.cluster import adjusted_mutual_info_score
from sklearn.metrics.cluster import adjusted_rand_score
from sklearn.metrics.cluster import completeness_score
from sklearn.metrics.cluster import contingency_matrix
from sklearn.metrics.cluster import entropy
from sklearn.metrics.cluste... | bsd-3-clause |
ClimbsRocks/auto_ml | tests/core_tests/categorical_ensembling_test.py | 1 | 1941 | import os
import sys
sys.path = [os.path.abspath(os.path.dirname(__file__))] + sys.path
sys.path = [os.path.abspath(os.path.dirname(os.path.dirname(__file__)))] + sys.path
os.environ['is_test_suite'] = 'True'
from auto_ml import Predictor
import dill
import numpy as np
from nose.tools import assert_equal, assert_not... | mit |
Obus/scikit-learn | examples/cluster/plot_digits_linkage.py | 369 | 2959 | """
=============================================================================
Various Agglomerative Clustering on a 2D embedding of digits
=============================================================================
An illustration of various linkage option for agglomerative clustering on
a 2D embedding of the di... | bsd-3-clause |
themrmax/scikit-learn | examples/text/document_clustering.py | 32 | 8526 | """
=======================================
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.