[scikit-learn] sklearn.cluster.Birch

Sema Atasever s.atasever at gmail.com
Mon Apr 10 13:03:31 EDT 2017


Hi Şükrü,

I realized I needed to use space as a delimiter, problem solved.

Thanks for your help, it is really appreciated.


On Mon, Apr 10, 2017 at 2:37 PM, Şükrü Bezen <sukru at sukrubezen.com> wrote:

> Hi,
>
> You may have one last separator at the end of every row in your data which
> makes your rows create one extra empty entity which results with that error.
> Or maybe your data can not be cast into float?
>
> If you provide an example row, I could help more.
>
> Best,
>
> On Mon, Apr 10, 2017 at 2:29 PM, Sema Atasever <s.atasever at gmail.com>
> wrote:
>
>> Dear Manoj,
>>
>> Thanks for your answer but when i execute the code below i get this error
>> :  "*ValueError: could not convert string to float:*"
>>
>> How can i solve this error.
>>
>> Regards.
>>
>> ---------------------------------------------
>> from sklearn.cluster import Birch
>> from io import StringIO
>> import numpy as np
>>
>> X=np.loadtxt(open("C:\features.dat", "rb"), delimiter="\t")
>>
>>
>> brc = Birch(branching_factor=50, n_clusters=None,
>> threshold=0.5,compute_labels=True)
>> brc.fit(X)
>> Birch(branching_factor=50, compute_labels=True, copy=True,
>> n_clusters=None,threshold=0.5)
>> brc.predict(X)
>>
>> print(brc.predict(X))
>>
>> On Thu, Apr 6, 2017 at 4:29 PM, Manoj Kumar <
>> manojkumarsivaraj334 at gmail.com> wrote:
>>
>>> Hi, See: https://docs.scipy.org/doc/numpy/reference/generated/numpy.l
>>> oadtxt.html for one way.
>>>
>>> On Thu, Apr 6, 2017 at 8:27 AM, Sema Atasever <s.atasever at gmail.com>
>>> wrote:
>>>
>>>> Dear scikit-learn members,
>>>>
>>>> I have a dat file where the columns represent the features and the rows
>>>> represent the protein. (you can see the dat file in the attachment)
>>>>
>>>>
>>>> i want to use *sklearn.cluster.Birch* with this text file values as X
>>>> which is the
>>>>
>>>> Parameters:
>>>> X : {array-like, sparse matrix}
>>>>
>>>> How can i transform this text file values into X : {array-like, sparse
>>>> matrix}.
>>>>
>>>> I would appreciate if you could advise on some methods.
>>>> Thanks.
>>>>
>>>> _______________________________________________
>>>> scikit-learn mailing list
>>>> scikit-learn at python.org
>>>> https://mail.python.org/mailman/listinfo/scikit-learn
>>>>
>>>>
>>>
>>>
>>> --
>>> Manoj,
>>> http://github.com/MechCoder
>>>
>>> _______________________________________________
>>> scikit-learn mailing list
>>> scikit-learn at python.org
>>> https://mail.python.org/mailman/listinfo/scikit-learn
>>>
>>>
>>
>> _______________________________________________
>> scikit-learn mailing list
>> scikit-learn at python.org
>> https://mail.python.org/mailman/listinfo/scikit-learn
>>
>>
>
>
> --
> --------------------------------------------------
> Şükrü BEZEN
>
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20170410/f3fc4dba/attachment.html>


More information about the scikit-learn mailing list