Skip to main content

All Questions

4 votes
0 answers
110 views

Python 2.7 with numpy needs only halve of the threads than Python 3.7 and run 5 time faster

Problem: I am using Micheal Nielsen's python 2.7 code to learn machine learning (his github) and I am trying to transfer his file network.py and mnist_loader.py from python 2.7 to python 3.7. ...
MH Yip's user avatar
  • 329
0 votes
1 answer
4k views

How can I add class labels in python?

I have gaussian data which is: r1=np.random.multivariate_normal(mean1, cov1, 3000) r2=np.random.multivariate_normal(mean2, cov2, 3000) Now I want to add class labels for these datas to train a ...
yasser's user avatar
  • 31
0 votes
0 answers
59 views

Python error no attribute found

Am working on machine learning project so When I import the text file which is a table of values where no columns titles when I wrote this : import numpy Data = numpy.genfromtext( « test.txt » , ...
B.jaw's user avatar
  • 1
0 votes
1 answer
931 views

Perceptron implementation, decision boundary will not plot

I am attempting to implement a perceptron. I have loaded a 100x2 array of values between 0 and 100. Each item in the array has a label of either -1 or 1. I believe the perceptron is working, however ...
rosswin's user avatar
-3 votes
1 answer
190 views

k-Nearest Neighbors rundown

I'm trying to follow an example on k-Nearest Neighbors and I'm not sure about the numpy command syntax. I'm supposed to be doing a matrix-wise distance calculation and the code given is def classify(...
Chris Hoy's user avatar
0 votes
1 answer
232 views

Numpy giving error when not imported.

So I'm trying out machine learning, and following a tutorial I found online. For some reason when I run my code numpy is giving me an error, even-though I am not importing that library. (I've been ...
user avatar
0 votes
1 answer
2k views

label_keys type error on DNNCLassifier Tensorflow

I want to embed labels into a DNNClassifier model in Tensorflow. Unlike the documentation example, here , I get the following error message: label_keys_values = ["satan", "ipsweep",...
Andrei's user avatar
  • 113
0 votes
0 answers
2k views

TypeError: float() argument must be a string or a number, not 'map'

I am running a simple program from GitHub (https://github.com/tyleryasaka/weatherman). It gives me this error: Traceback (most recent call last): File "C:/Users/Humxa/Desktop/weatherman-...
Code Black's user avatar
7 votes
1 answer
451 views

How can I optimize the calculation over this function in numpy?

I want to implement the following problem in numpy and here is my code. I've tried the following numpy code for this problem with one for loop. I am wondering if there is any more efficient way of ...
xxx222's user avatar
  • 3,254
1 vote
0 answers
626 views

Enron email data set spam classification

I am trying to clean the Enron email data set. I have got all the files read and displayed by the code below: import os directory = os.path.normpath("C:/Users/cool_/Desktop/Enron/Enron1/ham") for ...
metalmks's user avatar
0 votes
0 answers
549 views

Similar Users in MovieLens Data

I am trying to find the similar users in Movie Lens data using numpy in python so that all calculations are fast. However, I am not able to get the final code to find similarity using matrices ...
Manish Kumar's user avatar
  • 1,479
2 votes
1 answer
3k views

Could someone explain this neural network machine learning code?

import numpy as np def nonlin(x, deriv=False): if (deriv == True): return (x * (1 - x)) return 1 / (1 + np.exp(-x)) X = np.array([[1,1,1], [3,3,3], [2,2,2]...
some_person's user avatar
5 votes
1 answer
9k views

confused about numpy.c_ document and sample code

I read the document about numpy.c_ many times but still confused. It is said -- "Translates slice objects to concatenation along the second axis." in the following document. Could anyone clarify in ...
Lin Ma's user avatar
  • 10.2k
0 votes
1 answer
144 views

numpy.ndarray syntax understanding for confirmation

I am referring the code example here (http://scikit-learn.org/stable/auto_examples/linear_model/plot_iris_logistic.html), and specifically confused by this line iris.data[:, :2], since iris.data is ...
Lin Ma's user avatar
  • 10.2k
7 votes
2 answers
5k views

numpy reshape confusion with negative shape values

Always confused how numpy reshape handle negative shape parameter, here is an example of code and output, could anyone explain what happens for reshape [-1, 1] here? Thanks. Related document, using ...
Lin Ma's user avatar
  • 10.2k

15 30 50 per page