Ask Your Question

Server/Client hide code, 3D Animation, etc (bachelor thesis)

asked 2013-03-04 03:10:29 -0600

snooc gravatar image

updated 2013-03-04 04:11:51 -0600

Right now I am evaluting for my bachelor thesis in computer science wich software would be the best to create graphical plots for learning-algorithms like backpropagation (neural networks) oder k-nearest-neighbor (classification) and so on.

Sage seems to be very powerful and covers A HUGE AMOUNT of my needs..

Still.. I could not find an easy way to hide the sourcecode to a user. I require this since I am going to implement some examples for students which they will have to solve on their own. This is why I cannot provide any sourcecode. (%hideall is NOT enough) I know how I would do this but is there already an easy way to accomplish that?

The other thing is this.. I'd like to create partly interactive 3D animations, for example gradient descent. A student should be able to adapt the learning rate and it would be great if the 3D plot got an animated line that slowly finds its way to the minimal error.

Thank you for your answers.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-03-04 19:51:36 -0600

ppurka gravatar image

About hiding source code - you can do the following:

  1. Write your code in a .sage and run sage -python a.sage to generate the .py file, OR directly write a python .py file. Let us say the file name is
  2. Run sage -ipython and then compile the python file to a .pyc file by doing the following

    In [1]: import py_compile

    In [2]: py_compile.compile('')

  3. Now you have a a.pyc file in the current directory. In your worksheet, use Data -> Upload or create file to upload this a.pyc file.

  4. Next, in a cell add the DATA to your PYTHONPATH like this

    os.environ['PYTHONPATH'] += (':' + DATA)

  5. Finally, import your functions and other stuff from a.pyc by running

    from a import *

It should not be possible to see the source code of your functions. I don't know if there is any way of getting the source code out of a pyc file. If it is possible, then a really curious student will simply download this file and decompile it.

About 3D interactive animations - I don't think it is possible. You can have some interactivity by using the @interact decorator, but it is in no way a smooth or very responsive way of implementing what you want.

edit flag offensive delete link more


Thank you for your answer! I am going to try this and report in when I'm done. Could take a few days since I got to learn for a final...

snooc gravatar imagesnooc ( 2013-03-05 01:02:09 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-03-04 03:10:29 -0600

Seen: 315 times

Last updated: Mar 04 '13