np.loadtxt
For the method np.loadtxt there is no dtype: np.str, what are you supposed to use instead?
I'll check it out and add what's missing.
hmm, I don't really understand how numpy is used with strings at all, that probably is the reason why the support is not great at the moment. I ported two of the three examples from the np.loadtxt docs and they work:
[TestMethod]
public void loadtxtTest()
{
// >>> from io import StringIO # StringIO behaves like a file object
// >>> c = StringIO(u"0 1\n2 3")
// >>> np.loadtxt(c)
// array([[ 0., 1.],
// [ 2., 3.]])
//
string tempFile = Path.GetTempFileName();
File.WriteAllText(tempFile, "0 1\n2 3");
var given= np.loadtxt(tempFile);
var expected=
"array([[0., 1.],\n" +
" [2., 3.]])";
Assert.AreEqual(expected, given.repr);
// >>> c = StringIO(u"1,0,2\n3,0,4")
// >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True)
// >>> x
// array([ 1., 3.])
// >>> y
// array([ 2., 4.])
//
File.WriteAllText(tempFile, "1,0,2\n3,0,4");
var a= np.loadtxt(tempFile, delimiter:",", usecols:new []{0, 2}, unpack:true);
given= a[0];
expected=
"array([1., 3.])";
Assert.AreEqual(expected, given.repr);
given= a[1];
expected=
"array([2., 4.])";
Assert.AreEqual(expected, given.repr);
}
Can you show me a similar simple use case for your problem? Like a few lines on the interactive Python console (similar to the ones above in the test case) so I can write a test case from it?
by the way, there is np.unicode_
I've got to sleep but one other thing (I guess I do a lot with strings) but can we have the 'fit_on_texts' and 'texts_to_matrix' functions connected up from keras? They are in keras.preprocessing.text import Tokenizer. You create a new Tokenizer an then it exposes those methods. Its useful when training models to deal with things like categorizing company names. Thanks for all the hard work, Ron
On Fri, Aug 16, 2019, 3:10 AM Meinrad Recheis [email protected] wrote:
hmm, I don't really understand how numpy is used with strings at all, that probably is the reason why the support is not great at the moment. I ported two of the three examples from the np.loadtxt docs and they work:
[TestMethod] public void loadtxtTest() { // >>> from io import StringIO # StringIO behaves like a file object // >>> c = StringIO(u"0 1\n2 3") // >>> np.loadtxt(c) // array([[ 0., 1.], // [ 2., 3.]]) // string tempFile = Path.GetTempFileName(); File.WriteAllText(tempFile, "0 1\n2 3"); var given= np.loadtxt(tempFile); var expected= "array([[0., 1.],\n" + " [2., 3.]])"; Assert.AreEqual(expected, given.repr); // >>> c = StringIO(u"1,0,2\n3,0,4") // >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True) // >>> x // array([ 1., 3.]) // >>> y // array([ 2., 4.]) // File.WriteAllText(tempFile, "1,0,2\n3,0,4"); var a= np.loadtxt(tempFile, delimiter:",", usecols:new []{0, 2}, unpack:true); given= a[0]; expected= "array([1., 3.])"; Assert.AreEqual(expected, given.repr); given= a[1]; expected= "array([2., 4.])"; Assert.AreEqual(expected, given.repr); }Can you show me a similar simple use case for your problem? Like a few lines on the interactive Python console (similar to the ones above in the test case) so I can write a test case from it?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SciSharp/Numpy.NET/issues/14?email_source=notifications&email_token=AKBI5464QLKHNFOEEFAQK2TQEZ4IJA5CNFSM4IMCX7S2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4OHSAI#issuecomment-521959681, or mute the thread https://github.com/notifications/unsubscribe-auth/AKBI543GDMVBHCD4UV5QDBLQEZ4IJANCNFSM4IMCX7SQ .
Yes, I did see that.
On Fri, Aug 16, 2019, 3:20 AM Meinrad Recheis [email protected] wrote:
by the way, there is np.unicode_
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SciSharp/Numpy.NET/issues/14?email_source=notifications&email_token=AKBI544P4VVWYWO2YELPKW3QEZ5PJA5CNFSM4IMCX7S2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4OIG6Q#issuecomment-521962362, or mute the thread https://github.com/notifications/unsubscribe-auth/AKBI544BEGM5HKHFPMGRBWTQEZ5PJANCNFSM4IMCX7SQ .
can this be closed?
Yeah, I got it all working in the end but it was too slow re training and so in the end I just wrote my own neural network. But I do like the implementation. Thanks.
On Fri, Oct 4, 2019, 2:22 AM Meinrad Recheis [email protected] wrote:
can this be closed?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SciSharp/Numpy.NET/issues/14?email_source=notifications&email_token=AKBI547YUA4G3ELCQU6FMALQM4DMVA5CNFSM4IMCX7S2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEALCHJA#issuecomment-538321828, or mute the thread https://github.com/notifications/unsubscribe-auth/AKBI543QSLVV36BNN5LBIE3QM4DMVANCNFSM4IMCX7SQ .