I'm a student who's considering doing a project for a Machine Learning
class on pathing (bots learning to run through a maze). The language
primarily used by the class has been Matlab. I would prefer to do the
bulk of the project in python because I'm familiar with pygame (for the
visuals) but I already have a lot of AI code written in Matlab.
I'd like to be able to call Matlab code from within python. I'm not sure
this is possible. My code runs in Octave just fine. I've heard about
numerical python and scipy, but I'm not sure what tool is going to mean
the least amount of recoding for me. At the very least I need to find a
really fast package for matrix operations.
Anyone have any input on what the best tool for the job would be? I've
googled, but I figure it's best to ask experience ;) 4 2762
dataangel wrote: I'm a student who's considering doing a project for a Machine Learning class on pathing (bots learning to run through a maze). The language primarily used by the class has been Matlab. I would prefer to do the bulk of the project in python because I'm familiar with pygame (for the visuals) but I already have a lot of AI code written in Matlab.
I'd like to be able to call Matlab code from within python. I'm not sure this is possible. My code runs in Octave just fine.
There have been some bridges between Matlab and Python, but most of them
are old, I believe. http://claymore.engineer.gvsu.edu/~s...hon/pymat.html
If you're on Windows, this may help: http://www.geocities.com/ptmcg/pytho...om_python.html
I've heard about numerical python and scipy, but I'm not sure what tool is going to mean the least amount of recoding for me. At the very least I need to find a really fast package for matrix operations.
That would be Numeric and scipy. You'll probably need Numeric anyways
for pygame. scipy has a set of functions that try to mimic Matlab
functionality with the same names, so that may help in translating the code.
Anyone have any input on what the best tool for the job would be? I've googled, but I figure it's best to ask experience ;)
--
Robert Kern rk***@ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
Robert Kern <rk***@ucsd.edu > writes: dataangel wrote: I'm a student who's considering doing a project for a Machine Learning class on pathing (bots learning to run through a maze). The language primarily used by the class has been Matlab. I would prefer to do the bulk of the project in python because I'm familiar with pygame (for the visuals) but I already have a lot of AI code written in Matlab. I'd like to be able to call Matlab code from within python. I'm not sure this is possible. My code runs in Octave just fine.
There have been some bridges between Matlab and Python, but most of them are old, I believe.
http://claymore.engineer.gvsu.edu/~s...hon/pymat.html
Actually, I've written a highlevel matlab-python bridge (based on bugfixed and
slightly extended version of the original pymat) which is quite up-to-date; by
and large it makes using matlab from python as easy as if matlab were just
some python library: from mlabwrap import mlab; mlab.plot([1,2,3],'-o')
<imagine plot here> mlab.sin([4,5,6])
array([[-0.7568025 ],
[-0.95892427],
[-0.2794155 ]])
As you can see from the last example there a certain minor idiosyncrasies
stemming from unbridgable semantic differences between matlab and python
(matlab doesn't have "real" vectors, which means that Numeric vectors are
translated to Nx1 matrices), also the call to matlab of course incurs a
significant overhead compared to Numeric.sin.
All in all I it works quite well for me, though (I've been using it
productively for years now and a couple of other people have also used it) --
so I guess I should finally announce it (there were a few minor things I
wanted to add first, but since people periodically ask for something like it
on c.l.py so now would seem like a good time).
You can find it on sourceforge:
<http://mlabwrap.sf.net >
I'd appreciate feedback.
'as
p.s. never mind the project activity meter at 0% -- as you can see the latest
version was uploaded mid january this year.
Alexander Schmolck wrote: Actually, I've written a highlevel matlab-python bridge (based on bugfixed and slightly extended version of the original pymat) which is quite up-to-date; by and large it makes using matlab from python as easy as if matlab were just some python library:
Fantastic! I've added a link to the Scipy Wiki: http://www.scipy.org/wikis/topical_s...opicalSoftware
--
Robert Kern rk***@ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
Robert Kern <rk***@ucsd.edu > writes: Alexander Schmolck wrote:
Actually, I've written a highlevel matlab-python bridge (based on bugfixed and slightly extended version of the original pymat) which is quite up-to-date; by and large it makes using matlab from python as easy as if matlab were just some python library:
Fantastic! I've added a link to the Scipy Wiki:
http://www.scipy.org/wikis/topical_s...opicalSoftware
Thanks -- I've now also posted announcements to the relevant forums, so I
guess I'll find out pretty soon if others deem it to be useful (working :).
'as This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Carl |
last post by:
I have been using Python for quite some time now and I love it. I use it
mainly for explorative computing and numerical prototyping, ie testing and
trying out different kinds of algorithms and computational schemes. The use
of Python as my first-choice language has made me extremely productive.
Now, I have always believed that Python is a poor performer in terms of
numerical speed. My experience, however, is that the efficient use of...
|
by: Srinath Avadhanula |
last post by:
Hello,
I wanted to connect to an already existing MATLAB application from
python.
From the MATHWORKS documentation at:
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/ch07cl24.html
I see that to connect to an already existing MATLAB application, I
|
by: Nicolas Pernetty |
last post by:
Hello,
I'm looking for any work/paper/ressource about continuous system
simulation using Python or any similar object oriented languages (or
even UML theory !).
I'm aware of SimPy for discrete event simulation, but I haven't found
any work about continuous system.
I would like to develop a generic continous system simulator, and so
would be eager to join any open source effort on the subject.
|
by: bblais |
last post by:
Hello,
Let me start by saying that I am coming from a background using Matlab
(or Octave), and C++. I am going to outline the basic nuts-and-bolts
of how I work in these languages, and ask for some help to find out how
the same thing is done in Python. I am not sure what the standard is.
In C++, I open up an editor in one window, a Unix shell in another. I
write the code in the editor, then switch to the shell window for
compile...
|
by: Michael Tobis |
last post by:
Someone asked me to write a brief essay regarding the value-add
proposition for Python in the Fortran community. Slightly modified to
remove a few climatology-related specifics, here it is.
I would welcome comments and corrections, and would be happy to
contribute some version of this to the Python website if it is of
interest.
===
| |
by: Carl |
last post by:
I am desperately looking for a way to call Python from Matlab. I have become
used to Python's rich syntax and large number of libraries, and feel
ridiculously clumsy being stuck with Matlab's rather restricted facilities
for doing other things than standard mathematical work.
Does anyone know of good techniques (or readily available software) for
achieving a cross-language support between Python and Matlab?
Carl
|
by: Stef Mientki |
last post by:
hi All,
instead of questions,
my first success story:
I converted my first MatLab algorithm into Python (using SciPy),
and it not only works perfectly,
but also runs much faster:
MatLab: 14 msec
|
by: wang frank |
last post by:
Hi,
While comparing the speed of octave and matlab, I decided to do a similar
test for python and matlab. The result shows that python is slower than
matlab by a factor of 5. It is not bad since octave is about 30 time slower
than matlab.
Here is the result in matlab:
Elapsed time is 0.015389 seconds.
|
by: Eric |
last post by:
I'm learning Python (while coming from MATLAB). One question I have is
that if I have a list with say 8 elements, and I want just a few of
them how do I select them out. In MATLAB, if I just want the first,
fifth and eighth element I might do something like this:
b = a();
I can't seem to figure out a similar Python construct for selecting
specific indices. Any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |