473,409 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Python, Matlab and AI question

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 ;)
Jul 18 '05 #1
4 2734
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
Jul 18 '05 #2
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.
Jul 18 '05 #3
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
Jul 18 '05 #4
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
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
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...
0
by: Srinath Avadhanula | last post by:
Hello, I wanted to connect to an already existing MATLAB application from python. From the MATHWORKS documentation at: ...
19
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...
30
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...
53
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...
9
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...
11
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:...
4
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...
6
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
jinu1996
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...
0
tracyyun
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...
0
isladogs
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.