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 |
|---|---|---|---|---|---|
anewmark/galaxy_dark_matter | call2_age_lum.py | 1 | 10505 | import astropy.table as table
import numpy as np
from defcuts import *
from defflags import *
from halflight_first import *
from def_get_mags import *
from def_halflight_math import *
from def_ages import *
ty='mean'
stax=True
if stax==False:
tag=''
else:
tag='uplim'
txtdist= ''
txtslope=''
outdir='/Users/amand... | mit |
edublancas/dstools | src/dstools/sklearn/_all_grids.py | 2 | 3284 | big = {
"sklearn.ensemble.RandomForestClassifier": {
'n_estimators': [1, 10, 100, 1000],
'criterion': ['gini', 'entropy'],
'max_depth': [1, 5, 10, 20, 50, 100],
'max_features': ['sqrt', 'log2'],
'min_samples_split': [2, 5, 10]
},
"sklearn.ensemble.AdaBoostClassifier"... | mit |
IndraVikas/scikit-learn | sklearn/svm/classes.py | 37 | 39951 | import warnings
import numpy as np
from .base import _fit_liblinear, BaseSVC, BaseLibSVM
from ..base import BaseEstimator, RegressorMixin
from ..linear_model.base import LinearClassifierMixin, SparseCoefMixin, \
LinearModel
from ..feature_selection.from_model import _LearntSelectorMixin
from ..utils import check_X... | bsd-3-clause |
idealabasu/code_pynamics | python/pynamics_examples/babyboot.py | 1 | 2952 | # -*- coding: utf-8 -*-
"""
Written by Daniel M. Aukes
Email: danaukes<at>gmail.com
Please see LICENSE for full license.
"""
import pynamics
from pynamics.frame import Frame
from pynamics.variable_types import Differentiable,Constant,Variable
from pynamics.system import System
from pynamics.body import Body
from pynam... | mit |
mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/scipy/stats/_binned_statistic.py | 10 | 25912 | from __future__ import division, print_function, absolute_import
import numpy as np
from scipy._lib.six import callable, xrange
from scipy._lib._numpy_compat import suppress_warnings
from collections import namedtuple
__all__ = ['binned_statistic',
'binned_statistic_2d',
'binned_statistic_dd']
... | mit |
kjchalup/neural_networks | neural_networks/cgan.py | 1 | 9712 | """ Conditional Generative Adversarial Network.
This is in fact the Least-Squares CGAN, as I found it
yields best results so far. However, the GAN market
is developing rapidly.
"""
import sys
import time
import numpy as np
from matplotlib import pyplot as plt
from sklearn.preprocessing import MinMaxScaler
import tens... | gpl-3.0 |
rain1024/sklearn_tutorial | doc/skeletons/exercise_01.py | 4 | 7513 | """
Astronomy Tutorial: exercise 1
Classification of photometric sources
usage: python exercise_01.py datadir
- datadir is $TUTORIAL_DIR/data/sdss_colors
This directory should contain the files:
- sdssdr6_colors_class_train.npy
- sdssdr6_colors_class.200000.npy
Description:
In the tutorial, we u... | bsd-3-clause |
cython-testbed/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 |
steebchen/youtube-dl | youtube_dl/extractor/wsj.py | 30 | 4694 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
float_or_none,
unified_strdate,
)
class WSJIE(InfoExtractor):
_VALID_URL = r'''(?x)
(?:
https?://video-api\.wsj\.com/api-vid... | unlicense |
kyleabeauchamp/EnsemblePaper | code/figures/old/plot_ALA3_rama_single.py | 1 | 3375 | import itertools
import experiment_loader
import ALA3
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import mpl
import scipy.stats #Note no longe resi 0 but resi 1
import matplotlib
matplotlib.rcParams.update({'font.size': 18})
bayesian_bootstrap_run_list = [0,1]
ff = "amber96"
prior = "dirichlet"... | gpl-3.0 |
ryanmdavis/BioTechTopics | BioTechTopics.py | 1 | 33864 | import os, json, string, nltk, sys, inspect
from nltk.stem.porter import *
from sklearn.feature_extraction.text import TfidfVectorizer,CountVectorizer
from sklearn.decomposition import LatentDirichletAllocation
from nltk.corpus import stopwords
from sklearn.metrics.pairwise import linear_kernel
from summa import keywor... | mit |
nicain/dipde_dev | dipde/examples/cortical_column.py | 1 | 8941 | # Copyright 2013 Allen Institute
# This file is part of dipde
# dipde 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 option) any later version.
#
# dipde is dis... | gpl-3.0 |
andreh7/deap | examples/es/cma_mo.py | 10 | 4169 | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | lgpl-3.0 |
jirikuncar/invenio | invenio/legacy/webstat/engine.py | 7 | 105878 | # This file is part of Invenio.
# Copyright (C) 2007, 2008, 2010, 2011, 2013, 2014, 2015 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)... | gpl-2.0 |
rishizsinha/project-beta | code/regression_l1.py | 2 | 3208 | from sklearn import linear_model as splm
import numpy as np
from sklearn import preprocessing as pp
import scipy as sc
import matplotlib.pyplot as plt
from scipy import stats
lag = 1
y = stats.zscore(np.load("../data/filtered_data.npy"), axis=1, ddof=1)
yvar = np.var(y, axis=0)
print np.max(yvar), np.min(yvar)
# varm... | bsd-3-clause |
reimandlab/Visualistion-Framework-for-Genome-Mutations | website/imports/sites/psp.py | 1 | 6796 | from pathlib import Path
from pandas import read_table, to_numeric, DataFrame, concat, Series
import imports.protein_data as importers
from helpers.bioinf import aa_symbols
from imports.sites.site_importer import SiteImporter
from imports.sites.uniprot.importer import UniprotToRefSeqTrait, UniprotIsoformsTrait, Unipr... | lgpl-2.1 |
Eric89GXL/mne-python | tutorials/evoked/plot_10_evoked_overview.py | 4 | 15908 | """
.. _tut-evoked-class:
The Evoked data structure: evoked/averaged data
===============================================
This tutorial covers the basics of creating and working with :term:`evoked`
data. It introduces the :class:`~mne.Evoked` data structure in detail,
including how to load, query, subselect, export, ... | bsd-3-clause |
bartosh/zipline | zipline/sources/benchmark_source.py | 5 | 7493 | #
# Copyright 2015 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 |
jblackburne/scikit-learn | sklearn/svm/tests/test_bounds.py | 9 | 2471 | import nose
from nose.tools import assert_equal, assert_true
from sklearn.utils.testing import clean_warning_registry
from sklearn.utils.testing import assert_raise_message
import warnings
import numpy as np
from scipy import sparse as sp
from sklearn.svm.bounds import l1_min_c
from sklearn.svm import LinearSVC
from ... | bsd-3-clause |
maxiee/MyCodes | KalmanAndBesianFiltersInPython/Chapter1_g_h_filters/utils/book_plots.py | 2 | 2045 | # -*- coding: utf-8 -*-
"""
Created on Fri May 2 12:21:40 2014
@author: rlabbe
"""
import matplotlib.pyplot as plt
import numpy as np
def bar_plot(pos, ylim=(0,1), title=None):
plt.cla()
ax = plt.gca()
x = np.arange(len(pos))
ax.bar(x, pos, color='#30a2da')
if ylim:
plt.ylim(ylim)
plt... | gpl-3.0 |
jeepsterboy/waveletanalysis | utilities/utilities.py | 1 | 2403 | #!/usr/bin/env
"""
utilities.py
Using Anaconda packaged Python
"""
import datetime
import matplotlib as mpl
import numpy as np
__author__ = 'Shaun Bell'
__email__ = 'shaun.bell@noaa.gov'
__created__ = datetime.datetime(2013, 12, 20)
__modified__ = datetime.datetime(2013, 12, 20)
__version__ = "0.1.0"
__... | mit |
Insight-book/data-science-from-scratch | scratch/logistic_regression.py | 3 | 7642 |
tuples = [(0.7,48000,1),(1.9,48000,0),(2.5,60000,1),(4.2,63000,0),(6,76000,0),(6.5,69000,0),(7.5,76000,0),(8.1,88000,0),(8.7,83000,1),(10,83000,1),(0.8,43000,0),(1.8,60000,0),(10,79000,1),(6.1,76000,0),(1.4,50000,0),(9.1,92000,0),(5.8,75000,0),(5.2,69000,0),(1,56000,0),(6,67000,0),(4.9,74000,0),(6.4,63000,1),(6.2,8200... | unlicense |
hrishioa/Aviato | flask/Lib/site-packages/kartograph/kartograph.py | 4 | 5615 |
from options import parse_options
from shapely.geometry import Polygon, LineString, MultiPolygon
from errors import *
from copy import deepcopy
from renderer import SvgRenderer
from mapstyle import MapStyle
from map import Map
import os
# Kartograph
# ----------
verbose = False
# These renderers are currently avai... | gpl-2.0 |
dennissergeev/classcode | notebooks/satellite_basemap_h5.py | 1 | 10423 |
# coding: utf-8
# ## ***Plotting brightness temperatures in a Lambert Conformal Conic map projection***
# In this notebook we're going to continue working with http://clouds.eos.ubc.ca/~phil/Downloads/a301/MYD021KM.A2005188.0405.005.2009232180906.h5. We will also need to go to Laadsweb and do a wildcard search on
#... | cc0-1.0 |
wesm/arrow | python/pyarrow/tests/parquet/common.py | 4 | 6473 | # 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 u... | apache-2.0 |
jseabold/statsmodels | statsmodels/sandbox/panel/panelmod.py | 5 | 14585 | """
Sandbox Panel Estimators
References
-----------
Baltagi, Badi H. `Econometric Analysis of Panel Data.` 4th ed. Wiley, 2008.
"""
from functools import reduce
import numpy as np
from statsmodels.regression.linear_model import GLS
__all__ = ["PanelModel"]
from pandas import Panel
def group(X):
"""
Retu... | bsd-3-clause |
perslab/DEPICT | src/python/snpsnap_to_depict_collection.py | 1 | 5021 | #!/usr/bin/python
import pdb,math
import pandas as pd
from bx.intervals.cluster import ClusterTree
from bx.intervals.intersection import Interval
from bx.intervals.intersection import IntervalTree
from datetime import date
# SNPsnap collections for 1000 Genomes Project phase 3 can be downloaded from http://www.broadi... | gpl-3.0 |
fzalkow/scikit-learn | examples/semi_supervised/plot_label_propagation_digits_active_learning.py | 294 | 3417 | """
========================================
Label Propagation digits active learning
========================================
Demonstrates an active learning technique to learn handwritten digits
using label propagation.
We start by training a label propagation model with only 10 labeled points,
then we select the t... | bsd-3-clause |
KristoferHellman/gimli | python/pygimli/mplviewer/meshview.py | 1 | 30605 | # -*- coding: utf-8 -*-
"""
Draw mesh/model/fields with matplotlib.
"""
import matplotlib as mpl
from matplotlib.patches import Rectangle
from matplotlib.collections import PatchCollection
from matplotlib.colors import LogNorm
import numpy as np
import textwrap
from .colorbar import cmapFromName, autolevel
import... | gpl-3.0 |
Fokko/incubator-airflow | airflow/contrib/hooks/salesforce_hook.py | 2 | 12354 | # -*- 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 |
lbdreyer/cartopy | lib/cartopy/tests/mpl/test_pseudo_color.py | 1 | 1968 | # (C) British Crown Copyright 2013, Met Office
#
# This file is part of cartopy.
#
# cartopy is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any la... | lgpl-3.0 |
mitenjain/signalAlign | scripts/empire.py | 2 | 15411 | #!/usr/bin/env python
"""Run signal-to-reference alignments
"""
from __future__ import print_function
import pandas as pd
import glob
from signalAlignLib import *
from variantCallingLib import get_alignments_labels_and_mask
from alignmentAnalysisLib import CallMethylation
from multiprocessing import Process, Queue, cur... | mit |
ric2b/Vivaldi-browser | chromium/tools/perf/cli_tools/pinboard/pinboard_unittest.py | 1 | 10031 | # Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import shutil
import tempfile
import unittest
import mock
from cli_tools.pinboard import pinboard
from core.external_modules import pandas as pd
... | bsd-3-clause |
Agent007/deepchem | contrib/tensorflow_models/test_progressive.py | 6 | 4932 | '''
"""
Sanity tests on progressive models.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
__author__ = "Bharath Ramsundar"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"
import os
import tempfile
import numpy as np
import u... | mit |
glennq/scikit-learn | sklearn/linear_model/tests/test_sparse_coordinate_descent.py | 94 | 10801 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_true
from sklearn.utils.t... | bsd-3-clause |
heli522/scikit-learn | examples/cluster/plot_cluster_iris.py | 350 | 2593 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
K-means Clustering
=========================================================
The plots display firstly what a K-means algorithm would yield
using three clusters. It is then shown what the effect of a bad
initializa... | bsd-3-clause |
jmontoyam/mne-python | mne/decoding/tests/test_transformer.py | 3 | 10104 | # Author: Mainak Jas <mainak@neuro.hut.fi>
# Romain Trachel <trachelr@gmail.com>
#
# License: BSD (3-clause)
import warnings
import os.path as op
import numpy as np
from nose.tools import assert_true, assert_raises
from numpy.testing import (assert_array_equal, assert_equal,
assert_... | bsd-3-clause |
gotomypc/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 |
tlgs/MLschool | Linear_Regression/linear_regression.py | 2 | 2125 | import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
sys.path.append('../Optimization_Algorithms')
from Gradient_Descent.gradient_descent import gradient_desc
from other.feature_scaling import feature_scaling
## Simple Linear Regression
print("## Simple Linear Regression")
data = pd.read_c... | mit |
dhruv13J/scikit-learn | examples/cluster/plot_lena_ward_segmentation.py | 271 | 1998 | """
===============================================================
A demo of structured Ward hierarchical clustering on Lena image
===============================================================
Compute the segmentation of a 2D image with Ward hierarchical
clustering. The clustering is spatially constrained in order
... | bsd-3-clause |
dinhhuy2109/python-cope | cope/particlelib.py | 1 | 22331 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Huy Nguyen <huy.nguyendinh09@gmail.com>
#
# This file is part of python-cope.
#
# python-cope 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... | gpl-3.0 |
rohit21122012/DCASE2013 | runs/2016/baseline8/src/dataset.py | 37 | 78389 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import urllib2
import socket
import locale
import zipfile
import tarfile
from sklearn.cross_validation import StratifiedShuffleSplit, KFold
from ui import *
from general import *
from files import *
class Dataset(object):
"""Dataset base class.
The sp... | mit |
samzhang111/scikit-learn | sklearn/utils/tests/test_multiclass.py | 30 | 13404 |
from __future__ import division
import numpy as np
import scipy.sparse as sp
from itertools import product
from sklearn.externals.six.moves import xrange
from sklearn.externals.six import iteritems
from scipy.sparse import issparse
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sp... | bsd-3-clause |
anntzer/scipy | scipy/interpolate/_fitpack_impl.py | 16 | 46842 | """
fitpack (dierckx in netlib) --- A Python-C wrapper to FITPACK (by P. Dierckx).
FITPACK is a collection of FORTRAN programs for curve and surface
fitting with splines and tensor product splines.
See
https://web.archive.org/web/20010524124604/http://www.cs.kuleuven.ac.be:80/cwis/research/nalag/resea... | bsd-3-clause |
Ledoux/ShareYourSystem | Pythonlogy/build/lib/ShareYourSystem/Standards/Interfacers/Printer/__init__.py | 2 | 26126 | # -*- coding: utf-8 -*-
"""
<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>
The Printer is an object that can directly print
Strs in the Printer context.
"""
#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Interfacers.In... | mit |
mjgrav2001/scikit-learn | sklearn/datasets/lfw.py | 50 | 19048 | """Loader for the Labeled Faces in the Wild (LFW) dataset
This dataset is a collection of JPEG pictures of famous people collected
over the internet, all details are available on the official website:
http://vis-www.cs.umass.edu/lfw/
Each picture is centered on a single face. The typical task is called
Face Veri... | bsd-3-clause |
ashhher3/scikit-learn | sklearn/metrics/cluster/tests/test_supervised.py | 44 | 7663 | import numpy as np
from sklearn.metrics.cluster import adjusted_rand_score
from sklearn.metrics.cluster import homogeneity_score
from sklearn.metrics.cluster import completeness_score
from sklearn.metrics.cluster import v_measure_score
from sklearn.metrics.cluster import homogeneity_completeness_v_measure
from sklearn... | bsd-3-clause |
MSeifert04/astropy | astropy/table/__init__.py | 3 | 2566 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy import config as _config
class Conf(_config.ConfigNamespace):
"""
Configuration parameters for `astropy.table`.
"""
auto_colname = _config.ConfigItem(
'col{0}',
'The template that determines the name of a co... | bsd-3-clause |
rlowrance/re-local-linear | parcels.py | 1 | 4152 | 'hold all the knowledge about the layout of the CoreLogic parcels file'
# called record type 2580 in the Corelogic documentation
import numpy as np
import pandas as pd
import pdb
import sys
import zipfile
def is_parcel(df):
return df.columns[2] == 'APN UNFORMATTED'
# map feature name to fields
assessment_impro... | mit |
kenshay/ImageScripter | ProgramData/SystemFiles/Python/Lib/site-packages/dask/dataframe/reshape.py | 2 | 9337 | from __future__ import absolute_import, division, print_function
import numpy as np
import pandas as pd
from .core import Series, DataFrame, map_partitions, apply_concat_apply
from . import methods
from .utils import (
is_categorical_dtype, is_scalar, has_known_categories, PANDAS_VERSION
)
#####################... | gpl-3.0 |
greytip/data-science-utils | datascienceutils/timeSeriesUtils.py | 1 | 3761 | import pandas as pd
from bokeh.plotting import figure, show
from . import plotter
def test_stationarity(timeseries, timeCol, valueCol, skip_stationarity=False, title='timeseries', **kwargs):
from statsmodels.tsa.stattools import adfuller
calcStatsDf = pd.DataFrame()
#Determing rolling statistics
calcS... | gpl-3.0 |
tm507211/CoqPerceptron | Benchmarks/plots/makeplots.py | 1 | 2135 | # -*- coding: utf-8 -*-
from matplotlib import use
use('Agg')
import matplotlib.pyplot as plot
import numpy as np
plot.rcParams.update({'font.size': 16.1})
def plot_data(img_name, file_name, xlabel, yRange = None):
figure = plot.figure()
axis = figure.add_subplot(1, 1, 1)
A = []
B = []
C = []
E = []
F... | bsd-3-clause |
jereze/scikit-learn | examples/ensemble/plot_feature_transformation.py | 67 | 4285 | """
===============================================
Feature transformations with ensembles of trees
===============================================
Transform your features into a higher dimensional, sparse space. Then
train a linear model on these features.
First fit an ensemble of trees (totally random trees, a rand... | bsd-3-clause |
ssaeger/scikit-learn | sklearn/tree/export.py | 37 | 15886 | """
This module defines export functions for decision trees.
"""
# Authors: Gilles Louppe <g.louppe@gmail.com>
# Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Brian Holt <bdholt1@gmail.com>
# Noel Dawe <noel@dawe.me>
# Satrajit Gosh <satrajit.ghosh@gmail.com>
# Trevor... | bsd-3-clause |
Quadrocube/rep | tests/test_reports.py | 4 | 4166 | from __future__ import division, print_function, absolute_import
import numpy
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier, AdaBoostClassifier, \
RandomForestRegressor, GradientBoostingRegressor, AdaBoostRegressor
from sklearn.metrics import mean_squared_error
from rep.data.stor... | apache-2.0 |
bikong2/scikit-learn | sklearn/decomposition/tests/test_kernel_pca.py | 57 | 8062 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import (assert_array_almost_equal, assert_less,
assert_equal, assert_not_equal,
assert_raises)
from sklearn.decomposition import PCA, KernelPCA
from sklearn.datasets import mak... | bsd-3-clause |
parantapa/seaborn | seaborn/tests/test_rcmod.py | 9 | 7218 | import numpy as np
import matplotlib as mpl
from distutils.version import LooseVersion
import nose
import matplotlib.pyplot as plt
import nose.tools as nt
import numpy.testing as npt
from .. import rcmod
class RCParamTester(object):
def flatten_list(self, orig_list):
iter_list = map(np.atleast_1d, orig... | bsd-3-clause |
adityachechani/ECE601-Homework-1- | process_data.py | 1 | 1635 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 18 16:04:18 2017
@author: abhivora
"""
import pandas as pd
import datetime
#from datetime import date,time,datatime
#import calender
def get_data(file_name):
data = pd.read_csv(file_name)
day = []
sentiment= []
for i,j in zip(data['sentimen... | mit |
BoltzmannBrain/nupic.research | projects/sequence_prediction/mackey_glass/generate_line.py | 13 | 2270 | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | agpl-3.0 |
Srisai85/scikit-learn | sklearn/preprocessing/__init__.py | 268 | 1319 | """
The :mod:`sklearn.preprocessing` module includes scaling, centering,
normalization, binarization and imputation methods.
"""
from ._function_transformer import FunctionTransformer
from .data import Binarizer
from .data import KernelCenterer
from .data import MinMaxScaler
from .data import MaxAbsScaler
from .data ... | bsd-3-clause |
jskDr/keraspp | ex2_1_ann_mnist_cl.py | 1 | 4060 | ##############################################
# Modeling
##############################################
from keras import layers, models
def ANN_models_func(Nin, Nh, Nout):
x = layers.Input(shape=(Nin,))
h = layers.Activation('relu')(layers.Dense(Nh)(x))
y = layers.Activation('softmax')(layers.Dense(Nout... | mit |
rishikksh20/scikit-learn | sklearn/model_selection/_validation.py | 6 | 38471 | """
The :mod:`sklearn.model_selection._validation` module includes classes and
functions to validate the model.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>,
# Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
from __... | bsd-3-clause |
devlinmr/contrib | mungegithub/issue-labeler/simple_app.py | 20 | 4662 | #!/usr/bin/env python
# Copyright 2016 The Kubernetes Authors.
#
# 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 appli... | apache-2.0 |
ashhher3/scikit-learn | sklearn/cross_decomposition/tests/test_pls.py | 15 | 10172 | import numpy as np
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.datasets import load_linnerud
from sklearn.cross_decomposition import pls_
from nose.tools import assert_equal
def test_pls():
d = load_linnerud()
X = d.data
Y = d.target
# 1) Canonical (symmetric) PLS (PLS 2 b... | bsd-3-clause |
leejjoon/pywcsgrid2 | lib/aux_artists.py | 1 | 3979 |
import numpy as np
from matplotlib.patches import FancyArrowPatch
from matplotlib.text import Text
from matplotlib.offsetbox import AnchoredOffsetbox, AuxTransformBox
from pywcsgrid2.wcs_helper import estimate_angle_trans
class AnchoredCompass(AnchoredOffsetbox):
def __init__(self, ax, transSky2Pix, loc,
... | mit |
anthonyng2/Machine-Learning-For-Finance | Classification Based Machine Learning for Algorithmic Trading/default_predictions/SGDClassifier.py | 1 | 1554 | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 25 22:02:07 2017
@author: Anthony
"""
import numpy as np
import pandas as pd
df = pd.read_csv("dataset_2.csv")
df['default'].describe()
sum(df['default'] == 0)
sum(df['default'] == 1)
X = df.iloc[:, 1:6].values
y = df['default'].values
# Splitting th... | mit |
murali-munna/scikit-learn | examples/applications/plot_outlier_detection_housing.py | 243 | 5577 | """
====================================
Outlier detection on a real data set
====================================
This example illustrates the need for robust covariance estimation
on a real data set. It is useful both for outlier detection and for
a better understanding of the data structure.
We selected two sets o... | bsd-3-clause |
kpespinosa/BuildingMachineLearningSystemsWithPython | ch06/03_clean.py | 22 | 5972 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
#
# This script tries to improve the classifier by cleaning the tweets a bit
#
import time
start_time ... | mit |
CKehl/pylearn2 | pylearn2/models/tests/test_svm.py | 16 | 1025 | from __future__ import print_function
from pylearn2.datasets.mnist import MNIST
from pylearn2.testing.skip import skip_if_no_sklearn, skip_if_no_data
import numpy as np
from theano.compat.six.moves import xrange
import unittest
DenseMulticlassSVM = None
class TestSVM(unittest.TestCase):
def setUp(self):
g... | bsd-3-clause |
jaidevd/scikit-learn | sklearn/ensemble/gradient_boosting.py | 5 | 73159 | """Gradient Boosted Regression Trees
This module contains methods for fitting gradient boosted regression trees for
both classification and regression.
The module structure is the following:
- The ``BaseGradientBoosting`` base class implements a common ``fit`` method
for all the estimators in the module. Regressio... | bsd-3-clause |
HDLynx/sharingan | Proves_bordes_imatges.py | 1 | 1492 | import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('images.png') #Llegim imatge
px = img[100,100] #accedim al pixel 100, 100
print px #Imprimim els valors del pixel. ESTA EN BGR
# accessing only blue pixel
print img.item(100,100,2) #Accedir a pixel utilitzant numpy (pixel_x, pixel_y, ... | gpl-2.0 |
xavierwu/scikit-learn | sklearn/datasets/mlcomp.py | 289 | 3855 | # Copyright (c) 2010 Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
"""Glue code to load http://mlcomp.org data as a scikit.learn dataset"""
import os
import numbers
from sklearn.datasets.base import load_files
def _load_document_classification(dataset_path, metadata, set_=None, **kwargs):
if ... | bsd-3-clause |
asttra/game-of-life | highlife.py | 2 | 1320 | import numpy as np
import time
from lib import fft_convolve2d
import matplotlib.pyplot as plt
plt.ion()
def high_life(state, k=None):
"""
'HighLife' automata state transition
http://www.conwaylife.com/wiki/HighLife
"""
if k == None:
m, n = state.shape
k = np.zeros((m, n))
k[... | apache-2.0 |
aroberge/docpicture | examples/unsafe_matplotlib.py | 1 | 4683 | ''' Silly example
This is a rather silly example showing the potential power of docpicture,
but also highlighting some safety issue.
This file is not in the parser directory. Therefore, it is not recognized
by docpicture as a valid parser when it is started. However, in the demo,
we set the directive to be trusted... | bsd-3-clause |
andrewnc/scikit-learn | sklearn/datasets/tests/test_20news.py | 280 | 3045 | """Test the 20news downloader, if the data is available."""
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import SkipTest
from sklearn import datasets
def test_20news():
try:
data = dat... | bsd-3-clause |
johndpope/tensorflow | tensorflow/examples/learn/iris_run_config.py | 86 | 2087 | # 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 |
tehtechguy/mHTM | dev/mnist_novelty_detection/OneVsRest.py | 1 | 4537 | import os
import numpy as np
from sklearn.svm import OneClassSVM, LinearSVC
from sklearn.multiclass import OneVsRestClassifier, OneVsOneClassifier
from joblib import Parallel, delayed
from mHTM.datasets.loader import load_mnist, MNISTCV
from mHTM.metrics import SPMetrics
from mHTM.region import SPRegion
... | mit |
f3r/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 |
Nyker510/scikit-learn | sklearn/linear_model/tests/test_base.py | 120 | 10082 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.linear_model.... | bsd-3-clause |
apache/arrow | python/pyarrow/tests/test_schema.py | 4 | 20872 | # 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 u... | apache-2.0 |
Lafunamor/ns3 | src/flow-monitor/examples/wifi-olsr-flowmon.py | 108 | 7439 | # -*- Mode: Python; -*-
# Copyright (c) 2009 INESC Porto
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful,
#... | gpl-2.0 |
lancezlin/ml_template_py | lib/python2.7/site-packages/sklearn/neighbors/classification.py | 15 | 14359 | """Nearest Neighbor Classification"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck
# Multi-output support by Arnaud Joly <a.joly@ul... | mit |
jakobworldpeace/scikit-learn | sklearn/feature_selection/tests/test_base.py | 98 | 3681 | import numpy as np
from scipy import sparse as sp
from numpy.testing import assert_array_equal
from sklearn.base import BaseEstimator
from sklearn.feature_selection.base import SelectorMixin
from sklearn.utils import check_array
from sklearn.utils.testing import assert_raises, assert_equal
class StepSelector(Select... | bsd-3-clause |
Titan-C/scikit-learn | sklearn/utils/tests/test_multiclass.py | 58 | 14316 |
from __future__ import division
import numpy as np
import scipy.sparse as sp
from itertools import product
from sklearn.externals.six.moves import xrange
from sklearn.externals.six import iteritems
from scipy.sparse import issparse
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sp... | bsd-3-clause |
IshankGulati/scikit-learn | examples/cross_decomposition/plot_compare_cross_decomposition.py | 8 | 4765 | """
===================================
Compare cross decomposition methods
===================================
Simple usage of various cross decomposition algorithms:
- PLSCanonical
- PLSRegression, with multivariate response, a.k.a. PLS2
- PLSRegression, with univariate response, a.k.a. PLS1
- CCA
Given 2 multivari... | bsd-3-clause |
bikong2/scikit-learn | examples/neighbors/plot_digits_kde_sampling.py | 251 | 2022 | """
=========================
Kernel Density Estimation
=========================
This example shows how kernel density estimation (KDE), a powerful
non-parametric density estimation technique, can be used to learn
a generative model for a dataset. With this generative model in place,
new samples can be drawn. These... | bsd-3-clause |
mindw/shapely | docs/code/polygon2.py | 6 | 1798 | from matplotlib import pyplot
from matplotlib.patches import Circle
from shapely.geometry import Polygon
from descartes.patch import PolygonPatch
from figures import SIZE
COLOR = {
True: '#6699cc',
False: '#ff3333'
}
def v_color(ob):
return COLOR[ob.is_valid]
def plot_coords(ax, ob):
x, y = ob.... | bsd-3-clause |
botswana-harvard/bcpp-export | bcpp_export/old_export/dataframes/lis.py | 1 | 5128 | import re
import pymssql
import pandas as pd
import numpy as np
from sqlalchemy import create_engine
# from bcpp_export import urls # DO NOT DELETE
from bcpp_export.private_settings import Lis
from bcpp_export.communities import pair
from bhp066.apps.bcpp_clinic.models import ClinicConsent as EdcClinicConsent, Clini... | gpl-2.0 |
giorgiop/scikit-learn | examples/text/mlcomp_sparse_document_classification.py | 33 | 4515 | """
========================================================
Classification of text documents: using a MLComp dataset
========================================================
This is an example showing how the scikit-learn can be used to classify
documents by topics using a bag-of-words approach. This example uses
a s... | bsd-3-clause |
ricket1978/db.py | db/db.py | 1 | 63918 | import threading
import glob
import gzip
try:
from StringIO import StringIO # Python 2.7
except:
from io import StringIO # Python 3.3+
import uuid
import json
import base64
import re
import os
import sys
import pandas as pd
from prettytable import PrettyTable
import pybars
from .queries import mysql as mys... | bsd-2-clause |
lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/lib/mpl_examples/user_interfaces/embedding_in_wx3.py | 9 | 4849 | #!/usr/bin/env python
"""
Copyright (C) 2003-2004 Andrew Straw, Jeremy O'Donoghue and others
License: This work is licensed under the PSF. A copy should be included
with this source code, and is also available at
http://www.python.org/psf/license.html
This is yet another example of using matplotlib with wx. Hopeful... | mit |
jreback/pandas | pandas/tests/groupby/test_missing.py | 2 | 4283 | import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame, Index, date_range
import pandas._testing as tm
@pytest.mark.parametrize("func", ["ffill", "bfill"])
def test_groupby_column_index_name_lost_fill_funcs(func):
# GH: 29764 groupby loses index sometimes
df = DataFrame(
[[... | bsd-3-clause |
mahak/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 |
moonboots/tensorflow | tensorflow/python/client/notebook.py | 26 | 4596 | # Copyright 2015 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 a... | apache-2.0 |
mbayon/TFG-MachineLearning | vbig/lib/python2.7/site-packages/pandas/tests/frame/test_dtypes.py | 3 | 27153 | # -*- coding: utf-8 -*-
from __future__ import print_function
import pytest
from datetime import timedelta
import numpy as np
from pandas import (DataFrame, Series, date_range, Timedelta, Timestamp,
compat, concat, option_context)
from pandas.compat import u
from pandas.core.dtypes.dtypes import... | mit |
UNR-AERIAL/scikit-learn | sklearn/decomposition/tests/test_online_lda.py | 48 | 12645 | import numpy as np
from scipy.linalg import block_diag
from scipy.sparse import csr_matrix
from scipy.special import psi
from sklearn.decomposition import LatentDirichletAllocation
from sklearn.decomposition._online_lda import (_dirichlet_expectation_1d,
_dirichlet_expect... | bsd-3-clause |
datapythonista/pandas | pandas/tests/indexes/period/test_setops.py | 3 | 12827 | import numpy as np
import pandas as pd
from pandas import (
PeriodIndex,
date_range,
period_range,
)
import pandas._testing as tm
def _permute(obj):
return obj.take(np.random.permutation(len(obj)))
class TestPeriodIndex:
def test_union(self, sort):
# union
other1 = period_range(... | bsd-3-clause |
murali-munna/scikit-learn | sklearn/ensemble/tests/test_bagging.py | 127 | 25365 | """
Testing for the bagging ensemble module (sklearn.ensemble.bagging).
"""
# Author: Gilles Louppe
# License: BSD 3 clause
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.te... | bsd-3-clause |
jeffery-do/Vizdoombot | doom/lib/python3.5/site-packages/mpl_toolkits/tests/__init__.py | 8 | 2604 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from matplotlib.externals import six
import difflib
import os
from matplotlib import rcParams, rcdefaults, use
_multiprocess_can_split_ = True
# Check that the test directories exist
if not os.path.exists... | mit |
Titan-C/scikit-learn | sklearn/mixture/tests/test_bayesian_mixture.py | 84 | 17929 | # Author: Wei Xue <xuewei4d@gmail.com>
# Thierry Guillemot <thierry.guillemot.work@gmail.com>
# License: BSD 3 clause
import numpy as np
from scipy.special import gammaln
from sklearn.utils.testing import assert_raise_message
from sklearn.utils.testing import assert_almost_equal
from sklearn.mixture.bayesian... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.