This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit e5ca40b8972b0b7cd2210c1108ac696e94f675ce | |
Author: Manoj-Kumar-S <manojkumarsivaraj334@gmail.com> | |
Date: Sat Sep 7 23:53:55 2013 +0530 | |
Changed n to int(n) | |
diff --git a/sympy/solvers/ode.py b/sympy/solvers/ode.py | |
index a464f8a..9620b04 100644 | |
--- a/sympy/solvers/ode.py | |
+++ b/sympy/solvers/ode.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.datasets.samples_generator import make_regression | |
from scipy import sparse | |
X, y = make_regression(n_samples=500, n_features=20000, random_state=0) | |
X[X < 2.5] = 0 | |
mat = sparse.coo_matrix(X) | |
clf = ElasticNetCV(max_iter=2000) | |
%timeit clf.fit(mat,y) | |
1 loops, best of 3: 376 s per loop | |
clf = ElasticNetCV(max_iter=2000) | |
%timeit clf.fit(X, y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dense data | |
0 alpha 0.0855941772461 | |
1 alpha 0.0869829654694 | |
2 alpha 0.0868599414825 | |
3 alpha 0.0869789123535 | |
4 alpha 0.0870821475983 | |
5 alpha 0.0872299671173 | |
6 alpha 0.0973160266876 | |
7 alpha 0.0973291397095 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Strong rules for coordinate descent | |
Author: Fabian Pedregosa <fabian@fseoane.net> | |
""" | |
import numpy as np | |
from scipy import linalg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Accessing rows and columns. | |
for ptr in xrange(len(csc.indptr) - 1): | |
strptr = csc.indptr[ptr] | |
endptr = csc.indptr[ptr + 1] | |
temp = xrange(strptr, endptr) | |
if temp: | |
for row in temp: | |
print ptr, csc.data[row], csc.indices[row] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy.distutils.system_info import get_info | |
import os | |
from os.path import join | |
import numpy | |
def configuration(): | |
from numpy.distutils.misc_util import Configuration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from libc.math cimport fabs, sqrt | |
cimport cython | |
cdef extern from "cblas.h": | |
void daxpy "cblas_daxpy"(int N, double alpha, double *X, int incX, | |
double *Y, int incY) | |
def b(int x): | |
print x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pylab as pl | |
import numpy as np | |
from sklearn.linear_model import * | |
from sklearn.datasets import make_regression | |
import time | |
def plot(): | |
pl.figure("Benchmark with nogil") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.linear_model import ElasticNetCV | |
from sklearn.datasets import make_regression | |
import numpy as np | |
from scipy.sparse import csr_matrix | |
X, y = make_regression(n_samples=2000, n_features=2000) | |
clf = ElasticNetCV(n_jobs=4, cv=3, n_alphas=100, fit_intercept=False, l1_ratio=np.linspace(0.1, 0.9, 5)) | |
clf.fit(X, y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.linear_model import LogisticRegressionCV | |
from sklearn.datasets import make_classification | |
from time import time | |
import numpy as np | |
rng = np.random.RandomState(0) | |
X, y = make_classification(n_samples=2000, n_features=2000, random_state=rng) | |
clf = LogisticRegressionCV(n_jobs=4, Cs=[1, 10, 100, 1000], cv=10) | |
t = time() | |
clf.fit(X, y) |