I am new to Python and using it to learn machine learning.
Below is a sample program I am running to plot IRIS data set.
The code runs but no plot comes up. I am not sure what the issue is with the
code.
# Imports
from matplotlib import pyplot as plt
from sklearn.datasets import load_iris
import
On Saturday, 5 May 2018 10:59:13 UTC+5:30, John Ladasky wrote:
> On Friday, May 4, 2018 at 9:13:02 PM UTC-7, Sharan Basappa wrote:
> > I am new to Python and using it to learn machine learning.
> >
> > Below is a sample program I am running to plot IRIS data set.
> >
I am trying to install ipython. I already have python installed.
When I type "pip install ipython" I get the following messages:
Requirement already satisfied: setuptools>=18.5 in
d:\users\sharanb\appdata\local\programs\python\python36-32\lib\site-packages
(from ipython)
Requirement already sat
On Saturday, 5 May 2018 15:02:33 UTC+5:30, Steven D'Aprano wrote:
> On Sat, 05 May 2018 00:20:26 -0700, Sharan Basappa wrote:
>
> > After this, when I type ipython on command prompt, I don't get anything
> > on my windows.
>
> You don't get *anything*? No
On Saturday, 5 May 2018 15:39:32 UTC+5:30, Sharan Basappa wrote:
> On Saturday, 5 May 2018 15:02:33 UTC+5:30, Steven D'Aprano wrote:
> > On Sat, 05 May 2018 00:20:26 -0700, Sharan Basappa wrote:
> >
> > > After this, when I type ipython on command prompt, I d
In my program, I have print statements for debugging.
However, these are cluttering the display. So, I am trying to save
these to a file but somehow I cant seem to get it correct.
For example, the following are the print statement in my program:
print("target_names\n",target_names)
To print to a
On Saturday, 5 May 2018 19:00:12 UTC+5:30, Steven D'Aprano wrote:
> On Sat, 05 May 2018 04:25:50 -0700, Sharan Basappa wrote:
>
> > In my program, I have print statements for debugging. However, these are
> > cluttering the display. So, I am trying to save these to a file
On Saturday, 5 May 2018 22:05:53 UTC+5:30, Mark Lawrence wrote:
> On 05/05/18 12:25, Sharan Basappa wrote:
> > In my program, I have print statements for debugging.
> > However, these are cluttering the display. So, I am trying to save
> > these to a file but somehow I cant s
On Saturday, 5 May 2018 21:47:33 UTC+5:30, Steven D'Aprano wrote:
> On Sat, 05 May 2018 08:45:39 -0700, Sharan Basappa wrote:
>
> > Thanks a lot. I have actually tried print with file handle as a
> > parameter (the last option). I see that the file is created but nothing
&
On Sunday, 6 May 2018 10:48:12 UTC+5:30, Chris Angelico wrote:
> On Sun, May 6, 2018 at 3:10 PM, Sharan Basappa
> wrote:
> > On Saturday, 5 May 2018 21:47:33 UTC+5:30, Steven D'Aprano wrote:
> >> On Sat, 05 May 2018 08:45:39 -0700, Sharan Basappa wrote:
> &
I am a bit confused between module and package in Python.
Does a module contain package or vice versa?
When we import something in Python, do we import a module or a package?
Thanks
--
https://mail.python.org/mailman/listinfo/python-list
On Monday, 7 May 2018 23:09:41 UTC+5:30, Chris Angelico wrote:
> On Tue, May 8, 2018 at 2:53 AM, Sharan Basappa
> wrote:
> > I am a bit confused between module and package in Python.
> > Does a module contain package or vice versa?
> > When we import something in Pytho
MRAB, ChirisA,
One question. So, we can import the entire package or just a module in a given
package. Is this correct?
For example,
import nltk
import nltk.stem
--
https://mail.python.org/mailman/listinfo/python-list
On Tuesday, 8 May 2018 13:05:58 UTC+5:30, Steven D'Aprano wrote:
> On Mon, 07 May 2018 09:53:45 -0700, Sharan Basappa wrote:
>
> > I am a bit confused between module and package in Python. Does a module
> > contain package or vice versa? When we import something in Pyt
I have installed Python recently. Do I need to install PIP separately or this
would be part of default installation. When I run pip install <>, windows
complains that no such command exists
--
https://mail.python.org/mailman/listinfo/python-list
I see an issue while running ipython.
Can anyone help please.
D:\Users\sharanb>ipython notebook
[TerminalIPythonApp] WARNING | Subcommand `ipython notebook` is deprecated and
will be removed in future versions.
[TerminalIPythonApp] WARNING | You likely want to use `jupyter notebook` in the
futur
On Saturday, 12 May 2018 08:32:04 UTC+5:30, MRAB wrote:
> On 2018-05-12 03:47, Sharan Basappa wrote:
> > I have installed Python recently. Do I need to install PIP separately or
> > this would be part of default installation. When I run pip install <>,
> > windows com
This is regarding numpy array. I am a bit confused how parts of the array are
being accessed in the example below.
1 import scipy as sp
2 data = sp.genfromtxt("web_traffic.tsv", delimiter="\t")
3 print(data[:10])
4 x = data[:,0]
5 y = data[:,1]
Apparently, line 3 prints the first 10 entries in t
Can anyone please tell me what the following line in a python program does:
line = lambda x: x + 3
I have pasted the entire code below for reference:
from scipy.optimize import fsolve
import numpy as np
line = lambda x: x + 3
solution = fsolve(line, -2)
print solution
--
https://mail.python.org
Is there a specific location where user defined modules need to be kept?
If not, do we need to specify search location so that Python interpreter can
find it?
Also, when does Python interpreter compile the module code?
When it is imported?
--
https://mail.python.org/mailman/listinfo/python-list
The term mutable appears quite often in Python.
Can anyone explain what is meant by mutable and immutable sequences.
For example, Python lists are mutable.
BTW, is the below explanation correct (it is taken from a book I am reading)
Python lists are mutable sequences. They are very similar to tu
Can anyone explain to me the purpose of "pattern" in the line below:
documents.append((w, pattern['class']))
documents is declared as a list as follows:
documents.append((w, pattern['class']))
--
https://mail.python.org/mailman/listinfo/python-list
Thanks, All, for the responses.
--
https://mail.python.org/mailman/listinfo/python-list
> >Can anyone explain to me the purpose of "pattern" in the line below:
> >
> >documents.append((w, pattern['class']))
> >
> >documents is declared as a list as follows:
> >documents.append((w, pattern['class']))
>
> Not without a lot more context. Where did you find this code?
>
> Cheers,
I am
TC+5:30, Cameron Simpson wrote:
> On 14Jun2018 20:01, Sharan Basappa wrote:
> >> >Can anyone explain to me the purpose of "pattern" in the line below:
> >> >
> >> >documents.append((w, pattern['class']))
> >> >
> >> &g
Is there a difference between these prints. The first one looks a bit complex.
So, why should it be used?
my_age = 35 # not a lie
print "my age %s." % my_age
print "my age ", my_age
Output:
%run "D:/Projects/Initiatives/machine learning/programs/five.py"
my age 35.
my age 35
--
https://mail.p
On Sunday, 17 June 2018 07:25:57 UTC+5:30, Ben Bacarisse wrote:
> Cameron Simpson writes:
>
> > ... In Python 3 we have "format strings", which let you write:
> >
> > name = "Sharon"
> > age = 35
> > print(f"The person named {name|r} is {age} years old.")
>
> You meant {name!r} I think there
On Sunday, 17 June 2018 11:00:50 UTC+5:30, Ben Finney wrote:
> Sharan Basappa writes:
>
> > I think I am now confused with format options in Python.
>
> You should refer to the documentation for string formatting
> https://docs.python.org/3/library/stdtypes.htm
On Sunday, 17 June 2018 11:42:03 UTC+5:30, Jim Lee wrote:
> On 06/16/2018 10:13 PM, Sharan Basappa wrote:
> > I think I am now confused with format options in Python.
> > I tried an example as below and both print proper value:
> >
> > age = 35
> >
> > print
Hi All,
I am working out an exercise on curve_fit function available scipy package.
While I understand in general about curve_fit, I am unable to understand the
following:
params, params_covariance = optimize.curve_fit(test_func, x_data, y_data,
p0
> > Secondly, I don't understand how curve_fit knows the number of arguments
> > that test_func takes.
>
> Part of the dynamic nature of Python is that a function carries with it
> the number of parameters (as just one among many such properties). We
> call it "introspection" when we examine s
Folks,
I am trying to run a simple example associated with nltk.
I get some error and I don't know what the issue is.
I need some guidance please.
I am using python canopy distribution
The following is the code:
inputstring = ' This is an example sent. The sentence splitter will split on
sent
Folks,
I know this is not a machine learning forum but I wanted to see if anyone can
explain this to me.
In artificial neural network, I can understand why sigmoid is used but I see
that derivative of sigmoid output function is used. I am not able to understand
why.
For example:
# convert out
0
down vote
favorite
I need to change directory to my local working directory in windows and then
open a file for processing.
Its just a 3 lines code, as below:
import csv
import os
os.chdir('D:\Projects\Initiatives\machine learning\programs\assertion')
The error is as follows:
WindowsError: [E
On Saturday, 30 June 2018 16:51:53 UTC+5:30, Karsten Hilbert wrote:
> On Sat, Jun 30, 2018 at 04:05:22AM -0700, Sharan Basappa wrote:
>
> > I need to change directory to my local working directory in windows and
> > then open a file for processing.
> > Its just
Can anyone explain to me what the ? does here:
ignore_words = ['?']
--
https://mail.python.org/mailman/listinfo/python-list
On Saturday, 30 June 2018 18:05:02 UTC+5:30, Steven D'Aprano wrote:
> On Sat, 30 Jun 2018 04:47:44 -0700, Sharan Basappa wrote:
>
> >> The quick fix:
> >>
> >> put an r in front of the directory string: r'...'
> >
> > thanks. That wor
On Saturday, 30 June 2018 17:48:05 UTC+5:30, Steven D'Aprano wrote:
> On Sat, 30 Jun 2018 04:50:10 -0700, Sharan Basappa wrote:
>
> > Can anyone explain to me what the ? does here:
> >
> > ignore_words = ['?']
>
> Its a question mark inside
A code I am using as reference has the following line:
from nltk.stem.lancaster import LancasterStemmer
I am inferring the following based on above:
1) nltk is a package
2) nltk itself may have module because I see -
nltk.word_tokenize(pattern['sentence']) in the code
3) nltk has a package named
On Saturday, 30 June 2018 18:55:53 UTC+5:30, Karsten Hilbert wrote:
> On Sat, Jun 30, 2018 at 05:46:59AM -0700, Sharan Basappa wrote:
>
> > > >> The quick fix:
> > > >>
> > > >> put an r in front of the directory string: r'...'
>
I am using enthought for python. Trace module seems to be very useful for my
work but somehow I am unable to make it work.
When I use the following option, I get the following error:
%run -m trace --trace "D:/Projects/Initiatives/machine
learning/programs/debug_1.py"
UsageError: option --trace
Can anyone tell me if there are some good logger modules in Python.
I have tried both logging and trace in Canopy and both are not working.
Any help is appreciated.
--
https://mail.python.org/mailman/listinfo/python-list
Is there any difference in %d and %s below. I get the same result:
my_name = 'Zed A. Shaw'
my_age = 35 # not a lie
my_height = 74 # inches
print "Let's talk about %s." % my_name
print "He's %d inches tall." % my_height
print "He's %s inches tall." % my_height
Let's talk about Zed A. Shaw.
He's 7
Folks,
I am trying to use logging module and somehow I cannot make it work.
A simple code that I am trying is below. The commented code line 5,6 are other
options I have tried but don't work
#importing module
import logging
#Create and configure logger
#logging.basicConfig(filename="D:/Projec
Hi All,
I am new to Python though not new to programming.
I have implemented my first program in python that uses ML to do some
classification task. The whole code is in a single file currently.
It contains executable code as well as functions.
At the end of the program, I have series of calls
On Friday, 6 July 2018 09:32:08 UTC+5:30, Cameron Simpson wrote:
> On 05Jul2018 19:56, Sharan Basappa wrote:
> >I have implemented my first program in python that uses ML to do some
> >classification task. The whole code is in a single file currently.
> >It contains execu
On Friday, 6 July 2018 09:22:31 UTC+5:30, Chris Angelico wrote:
> On Fri, Jul 6, 2018 at 12:56 PM, Sharan Basappa
> wrote:
> > Please let me know if the following understanding of mine is correct.
> > I need to put the program code in a separate file and organize every
>
On Friday, 6 July 2018 09:22:31 UTC+5:30, Chris Angelico wrote:
> On Fri, Jul 6, 2018 at 12:56 PM, Sharan Basappa
> wrote:
> > Please let me know if the following understanding of mine is correct.
> > I need to put the program code in a separate file and organize every
>
On Saturday, 7 July 2018 18:22:23 UTC+5:30, Chris Angelico wrote:
> On Sat, Jul 7, 2018 at 10:02 PM, Sharan Basappa
> wrote:
> > On Friday, 6 July 2018 09:22:31 UTC+5:30, Chris Angelico wrote:
> >> On Fri, Jul 6, 2018 at 12:56 PM, Sharan Basappa
> >> wrote:
&g
On Sunday, 8 July 2018 11:52:39 UTC+5:30, Jim Lee wrote:
> On 07/07/18 21:21, Sharan Basappa wrote:
> >
> > sorry. there was a copy paste error when i posted. I pasted test_2.py for
> > both the files:
> >
> > here are the files again. The issue remains.
>
On Sunday, 8 July 2018 12:42:07 UTC+5:30, Christian Gollwitzer wrote:
> Am 08.07.18 um 06:21 schrieb Sharan Basappa:
> > sorry. there was a copy paste error when i posted. I pasted test_2.py for
> > both the files:
> >
> > here are the files again. The issue remains.
Is there a difference between functions and methods in Python.
For example, this is the text from tutorialpoint on Python:
Python includes the following list functions - cmp, len etc.
Python includes following list methods - append, count
A related question.
Refer to the following lines:
1) len
Thanks a lot.
On Sunday, 22 July 2018 04:02:23 UTC+5:30, Rick Johnson wrote:
> On Saturday, July 21, 2018 at 2:06:21 PM UTC-5, Sharan Basappa wrote:
> > Is there a difference between functions and methods in Python.
>
> Generally speaking, functions and methods are basica
Folks,
I get a lot confused while using print functions in Python.
For example, I get the same results for the following code:
str = "one two three"
print str
print "%s" %(str)
So, what is the need to use the second method which I see being used in many
programs I am referring to
--
https:/
On Sunday, 22 July 2018 13:32:16 UTC+5:30, Ben Finney wrote:
> Sharan Basappa writes:
>
> > Is there a difference between functions and methods in Python.
>
> Python's documentation includes a useful Glossary. See the terms
> https://docs.python.org/3/glossary
On Sunday, 22 July 2018 10:24:55 UTC+5:30, Cameron Simpson wrote:
> On 21Jul2018 21:33, Sharan Basappa wrote:
> >I get a lot confused while using print functions in Python.
> >
> >For example, I get the same results for the following code:
> >
> >str = "one
I am using a third party module that is returning list of lists.
I am using the example below to illustrate.
1 results = [['1', 0.99921393753233001]]
2 k = results[0]
3 print k[0]
4 print k[1]
Assume the line 1 is what is returned.
I am assigning that to another list (k on line 2) and then access
Thanks. This works in my example. Can you tell me how this works?
> You can simply unpack the inner list:
>
> a, b = results[0]
>
>
> Iwo Herka
>
> ‐‐‐ Original Message ‐‐‐
>
> On 22 July 2018 11:47 AM, Sharan Basappa wrote:
>
> >
&
In other programming languages (e.g. C, C++), as a good practice, variables are
declared right at the start of the program, irrespective of where it is
normally used. What is the practice in Python?
I see that, most of the code, declare variables where it is used and not at the
start of the pro
On Sunday, 22 July 2018 18:15:23 UTC+5:30, Frank Millman wrote:
> "Sharan Basappa" wrote in message
> news:8e261f75-03f7-4f80-a516-8318dd138...@googlegroups.com...
> >
> > I am using a third party module that is returning list of lists.
> > I am using the exam
asterisk
> operator:
>
> li = [1, 2, 3, 4]
> a, b, *c = li
>
> which is equivalent to:
>
>a = li[0]
>b = li[1]
>c = li[2:]
>
>
> Iwo Herka
> https://github.com/IwoHerka
>
> ‐‐‐ Original Message ‐‐‐
>
> On 22 Ju
On Sunday, 22 July 2018 21:07:17 UTC+5:30, Thomas Jollans wrote:
> On 22/07/18 14:53, Sharan Basappa wrote:
> > Thanks. I initially thought about this but did not know if this is legal
> > syntax.
>
> In this kind of situation – you think you know how to do something but
&g
I am quite new to Python. I am learning Python as I am interested in machine
learning. The issue is, I have not found any ML forum where novices like me can
get help. I have tried reddit and each of my posts have gone unanswered. Looks
like reddit forum prefers either abstract topics on ML or ve
> > I am quite new to Python. I am learning Python as I am interested in
> > machine learning. The issue is, I have not found any ML forum where
> > novices like me can get help. I have tried reddit and each of my posts
> > have gone unanswered.
>
> Which subreddits have you posted to?
its calle
On Monday, 6 August 2018 09:21:03 UTC+5:30, downtime wrote:
> You might also try courses on Udemy and Udacity. I know Udemy is always
> having sales on courses for like $10.99. They have beginner/novice
> courses for all kinds of topics and in my experience, there are some
> pretty good ones.
Act
What is wrong with the following code. Python does not show the plot.
from sklearn.datasets import load_digits
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
digits = load_digits()
digits.data.shape
kmeans = KMeans(n_clusters=10,random_state=0)
clusters = kmeans.fit_predict(d
I am not sure what the issue is with the 2nd file that assigns string to text
variable.
Here is the code:
# -*- coding: utf-8 -*-
text = “this’s a sent tokenize test. this is sent two. is this sent three? sent
4 is cool! Now it’s your turn.”
from nltk.tokenize import sent_tokenize
sent_tokenize_
I am running a program that I got as reference from GitHub.
I am running on windows OS.
Here is a snippet of the code (initial few lines).
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Shilin He'
import sys
sys.path.insert(0, 'D:\Projects\Initiatives\machine
learning\loglizer-mast
On Monday, 27 August 2018 22:45:47 UTC+5:30, Peter Otten wrote:
> Sharan Basappa wrote:
>
> > I am running a program that I got as reference from GitHub.
> > I am running on windows OS.
> >
> > Here is a snippet of the code (initial few lines).
> >
> &
I am running a small python code. The main module calls another data loader
module. I keep this getting this error.
AttributeError: 'str' object has no attribute 'raw_data'
I tried few things in the code and finally realized that no matter the line
number is 68 of data loader module. Of course
On Sunday, 9 September 2018 00:02:49 UTC+5:30, Peter Otten wrote:
> Sharan Basappa wrote:
>
> > I am running a small python code. The main module calls another data
> > loader module. I keep this getting this error.
> >
> > AttributeError: 'str' objec
I am loading a csv file using Pandas and then logging it back into another file
using logging module.
Here is one sample line from input file:
- 1117838570 2005.06.03 R02-M1-N0-C:J12-U11 2005-06-03-15.42.50.675872
R02-M1-N0-C:J12-U11 RAS KERNEL INFO instruction cache parity error corrected
Here
are there any requirements about the format of the CSV file when using read_csv
from pandas?
For example, is it necessary that the csv file has to have same number of
columns in every line etc.
I am trying to load a csv file and I get the following error.
I really don't know what the issue is ..
I have a design file that I am importing in a test file to run some tests.
The design file compiles fine when I run it standalone but when I import it in
the test file, I see error on the very first line where I am importing the
design file.
This is the line from test file:
"""
test my design
"
On Tuesday, 19 March 2019 08:34:25 UTC+5:30, Sharan Basappa wrote:
> I have a design file that I am importing in a test file to run some tests.
> The design file compiles fine when I run it standalone but when I import it
> in the test file, I see error on the very first line w
I am running a program and even though the program runs all fine, the log file
is missing. I have pasted first few lines of the code.
Any suggestions where I maybe going wrong?
import os
import csv
import logging
import assertion_design as asd
import random
#Create and configure logger
logging.
On Friday, 22 March 2019 09:09:14 UTC+5:30, DL Neil wrote:
> On 22/03/19 4:25 PM, Sharan Basappa wrote:
> > I am running a program and even though the program runs all fine, the log
> > file is missing. I have pasted first few lines of the code.
> >
> > Any suggestion
On Friday, 22 March 2019 09:09:16 UTC+5:30, adam@gmail.com wrote:
> On Thursday, March 21, 2019 at 10:26:14 PM UTC-5, Sharan Basappa wrote:
> > I am running a program and even though the program runs all fine, the log
> > file is missing. I have pasted first few lines of the
On Friday, 22 March 2019 09:13:18 UTC+5:30, MRAB wrote:
> On 2019-03-22 03:25, Sharan Basappa wrote:
> > I am running a program and even though the program runs all fine, the log
> > file is missing. I have pasted first few lines of the code.
> >
> > Any suggestion
On Sunday, 24 March 2019 10:57:13 UTC+5:30, Cameron Simpson wrote:
> On 23Mar2019 21:47, Sharan Basappa wrote:
> >On Friday, 22 March 2019 09:13:18 UTC+5:30, MRAB wrote:
> >> On 2019-03-22 03:25, Sharan Basappa wrote:
> >> > I am running a program and even though
On Sunday, 24 March 2019 14:20:36 UTC+5:30, Sharan Basappa wrote:
> On Sunday, 24 March 2019 10:57:13 UTC+5:30, Cameron Simpson wrote:
> > On 23Mar2019 21:47, Sharan Basappa wrote:
> > >On Friday, 22 March 2019 09:13:18 UTC+5:30, MRAB wrote:
> > >> On 2019-03-
I have a test program that imports a design program.
Both the programs need to log messages.
I have tried the following:
1) Both the programs have the following lines:
for handler in logging.root.handlers[:]:
logging.root.removeHandler(handler)
#Create and configure logger
filename = os.
I am trying to read a log file that is in CSV format.
The code snippet is below:
###
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
import numpy as np
import pandas as pd
import os
import csv
from numpy import genfromtxt
# read the CSV and get into X
On Saturday, 7 September 2019 21:18:11 UTC-4, MRAB wrote:
> On 2019-09-08 01:19, Sharan Basappa wrote:
> > I am trying to read a log file that is in CSV format.
> >
> > The code snippet is below:
> >
> > ###
> > import matplot
On Sunday, 8 September 2019 04:56:29 UTC-4, Andrea D'Amore wrote:
> On Sun, 8 Sep 2019 at 02:19, Sharan Basappa wrote:
> This is the error:
> > my_data_3 = my_data_2.astype(np.float)
> > could not convert string to float: " "81
>
> > As you can s
I have a numpy array that has data in the form of hex.
I would like to convert that into decimal/integer.
Need suggestions please.
--
https://mail.python.org/mailman/listinfo/python-list
On Sunday, 8 September 2019 12:45:45 UTC-4, Peter J. Holzer wrote:
> On 2019-09-08 05:41:07 -0700, Sharan Basappa wrote:
> > On Sunday, 8 September 2019 04:56:29 UTC-4, Andrea D'Amore wrote:
> > > On Sun, 8 Sep 2019 at 02:19, Sharan Basappa
> > > wrote:
> &
On Sunday, 8 September 2019 11:16:52 UTC-4, Luciano Ramalho wrote:
> >>> int('C0FFEE', 16)
> 12648430
>
> There you go!
>
> On Sun, Sep 8, 2019 at 12:02 PM Sharan Basappa
> wrote:
> >
> > I have a numpy array that has data in the form o
Can someone please help me to clarify the different between fit and predict
functions of kmeans?
--
https://mail.python.org/mailman/listinfo/python-list
89 matches
Mail list logo