Page 19 of 23

Re: Python tricks

Posted: July 20th, 2020, 2:36 pm
by ISayMoo
I'll post the code some time soon. It will be Open Source.
How's it going here? we would like to test it.
Precise, step-by-step documentation is essential.
It's something I tinker with in my spare time ;-)

Re: Python tricks

Posted: August 9th, 2020, 1:16 am
by ISayMoo
Cool. Is this public domain and can we use it for our ML project? 
There ya go.

Re: Python tricks

Posted: August 9th, 2020, 8:30 am
by Cuchulainn
Cool. Is this public domain and can we use it for our ML project? 
There ya go.
Great, thank you very much. I will relate it to the hinterland.
Will also send you our pybind11 - C++ checklist.

Re: Python tricks

Posted: August 9th, 2020, 5:56 pm
by ISayMoo
Thanks. Let me know if you have any questions.

Re: Python tricks

Posted: August 19th, 2020, 3:34 pm
by Cuchulainn
Anyone tries scipy {DE, brute, basin hopping, shgo} global optimisation as an alternative to ANN?

Severe test is Eggholder function; find global _and_ all locals ;)

Image

Re: Python tricks

Posted: August 24th, 2020, 10:15 pm
by tags
There have been quite a lot of developments in recent python versions. Is there a proper construct that would be like a class with no (or very basic) methods, and only (mainly) with attributes (anemic construct?). In C++, I would go for struct, I think (adding drama here; drama sells, right?). My use case is a Order object that would have security, size, order_type, and other such attributes.
All constructive comments/recommendations on this much welcome.
Thank you very much.  

Re: Python tricks

Posted: August 25th, 2020, 9:11 am
by Cuchulainn
Classes in  Python are not prize-winning TBH.

By a struct do you mean all data is public by default like in C++?

Plan B: Put Order in a module having attributes, def statements and bind functions.

In fact, this approach of breaking a software system into loosely-coupled and cohesive modules leads to code that is more maintainable than code using OOP.

Re: Python tricks

Posted: August 25th, 2020, 10:04 am
by tags
Classes in  Python are not prize-winning TBH.

By a struct do you mean all data is public by default like in C++?

Plan B: Put Order in a module having attributes, def statements and bind functions.
Thank you Cuchulainn.
Yes, you guessed it right. I would like all data is public e.g. the Book class will need to access data in that construct Order e.g. to check whether there already is an opened position for that security, and everything else...
Note: I'm keeping this order/book management code very light. It is not "real" trading position management system. It is aimed at handling some risk/capital/positions constraints of a RL trading agent (my related question in another Wilmott forum, recently).

Re: Python tricks

Posted: August 25th, 2020, 10:08 am
by Peniel
There have been quite a lot of developments in recent python versions. Is there a proper construct that would be like a class with no (or very basic) methods, and only (mainly) with attributes (anemic construct?). In C++, I would go for struct, I think (adding drama here; drama sells, right?). My use case is a Order object that would have security, size, order_type, and other such attributes.
All constructive comments/recommendations on this much welcome.
Thank you very much.  
maybe dataclass?

Re: Python tricks

Posted: August 25th, 2020, 10:25 am
by tags
There have been quite a lot of developments in recent python versions. Is there a proper construct that would be like a class with no (or very basic) methods, and only (mainly) with attributes (anemic construct?). In C++, I would go for struct, I think (adding drama here; drama sells, right?). My use case is a Order object that would have security, size, order_type, and other such attributes.
All constructive comments/recommendations on this much welcome.
Thank you very much.  
maybe dataclass?
Thank you for this suggestion @Peniel. I wasn't aware of dataclasses. I'm looking into it now,

Re: Python tricks

Posted: August 25th, 2020, 11:06 am
by ISayMoo
Seconding Peniel. dataclasses are the way to go now.

Re: Python tricks

Posted: August 25th, 2020, 4:00 pm
by katastrofa
Tagoma says that he wants a C++ struct-like type and you're recommending a type of a mutable object?

Alright, it's (frozen=True)
dataclass(*, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=True)

Re: Python tricks

Posted: August 26th, 2020, 11:11 am
by Cuchulainn
There have been quite a lot of developments in recent python versions. Is there a proper construct that would be like a class with no (or very basic) methods, and only (mainly) with attributes (anemic construct?). In C++, I would go for struct, I think (adding drama here; drama sells, right?). My use case is a Order object that would have security, size, order_type, and other such attributes.
All constructive comments/recommendations on this much welcome.
Thank you very much.  
maybe dataclass?
Can you give a sales pitch as this library looks like cargo cult at first glance. In other words, what's the compelling reason for using it?

Nice to see you again, @Peniel (your [$]e^5[$] thread was a gem, but it suffered a fate worse than that of Dresden, i.e. FUBAR).

Re: Python tricks

Posted: August 26th, 2020, 11:14 am
by Cuchulainn
At the end of the day, tagoma seems to be traditional data modelling ... SQL etc.?
COBOL is better. I'm kind of serious (Python is replacing Java for COBOL API)

https://pypi.org/project/cobutils/

tech python libraries are in C++, Fortran

Python wasn't built for DB, but COBOL was.

why not? save a lot of messing around. BTW I'll have you know I was a Michael Jackson certified COBOL programmer in 1980, using _real_ computers!

Software savvy 1980s >> 2020
https://en.wikipedia.org/wiki/Michael_A._Jackson

Re: Python tricks

Posted: August 31st, 2020, 10:08 pm
by ISayMoo
Cool. Is this public domain and can we use it for our ML project? 
There ya go.
Great, thank you very much. I will relate it to the hinterland.
Will also send you our pybind11 - C++ checklist.
Any thoughts on how to generate HTML documentation automatically for pybind11-generated Python modules? For C++ I do with Doxygen, but I don't know how to handle binary Python wrappers.