Barak Cohen's (1+ε) Cents: Computer Science and Algorithms Blog: 2008

Sunday, October 19, 2008

Statistical Data Mining Tutorials

Good Data Mining tutorials are not always easy to come by. Fortunately, Andrew Moore who is a professor of at Carnegie Mellon University has created quite a few excellent tutorials, covering the basics of Statistical Data Mining and Machine Learning. The tutorials are generally suited for undergrads, but I think just about anyone with a solid math background should be able to keep up. For the mathematically uninitiated (myself included) , Andrew also gives a good introduction to probability theory, so you're pretty much covered either way.

The list of topics includes:
  • Decision Tree
  • Bayesian Networks
  • Naive Bayesian Classifiers
  • K-means and Hierarchical Clustering
  • Neural Networks
  • Support Vector Machines
And much much more!

Take a look here, you won't be sorry.


Thursday, October 16, 2008

Ray Tracing: A Simple Java, Open Source Implementation

From Wikipedia: "Ray tracing is a technique for generating an image by tracing the path of light through pixels in an image plane. The technique is capable of producing a very high degree of photorealism".

Basically, it means that we want to render images by imitating how we perceive the physical world as its image is recreated in our mind using the light rays that hit objects in space and are then returned to our eyes. We do this by modeling the world in a virtual 3d space. We place a virtual "eye" which is looking at a given direction and has a viewing plane, which is the portion of the world which the eye sees. Then, project a "ray of light" from the eye and through each pixel on the viewing plane and follow the ray along its path in space.

We test to see if the ray intersects any objects along that path. If it does, we calculate the color of the object at the point of intersection, taking into account visible light sources, the object's properties such as color, material, etc. This process is actually known as "Ray Casting". To make it "Ray Tracing" we continue tracing the ray after the intersection to see if the reflected ray hits any objects, and so on.

One of the assignments in the Computer Graphics course I took last semester was to write a simple ray tracer in Java. Written by myself and my more than capable partner, Gur Dotan, the tracer was implemented from scratch, and includes the following features:
  1. Primitive objects: Sphere, Box, Disc, Cylinder, Rectangle and a Torus.
  2. Light sources: Directional, Point and Light Area.
  3. Phong lighting model: Diffuse, Specular, Ambient and Emission parameters for all objects.
  4. Textures: PNG files, or a Checkers pattern with variable size / colors.
  5. Recursive ray tracing: Trace rays reflection recursively upon intersection.
  6. Supersampling: Using multiple rays per pixel for anti-aliasing
You can download the application here. Simply run the JAR file to start things up. It is completely self contained and has no 3rd party dependencies. The right window is where you enter the model of the world, and you can download some reference scenes here. Then, simply click Render.

The source code is actually pretty straightforward, can be found here, in the form of an Eclipse project. A short document outlining things is contained in the zip file.

Please note that the code is provided mostly for educational purposes and it is released as-is, without warranty of any kind. That being said, feel free to make any use of it. It is free both as in "free beer" and as in "free speech".

If you're looking for a commercial grade ray tracer, I recommend POV-Ray, an excellent open source ray tracer written in C++.

Click to view in my Flickr

Have fun,

Wednesday, October 15, 2008

Hello World

Hello and welcome to my blog. My name is Barak Cohen and I'm a 3rd year Computer Science undergrad at Tel-Aviv University, Israel.

I've been meaning to start this blog for some time and have actually bought the domain name a while back. What kept me from writing so far is simply not being sure I'll be able to keep the blog alive, and nothing's sadder than seeing a idle blog whose last post was ages ago.

Today I've finally mustered up the courage to write, hoping I'll be able to keep going during the school year. I'm also hoping to have my brother Dekel, himself a CS grad student at TAU, post here as well. I'm also extending an open invitation to you, the reader. Please feel free to send any CS related content you deem worth publishing and I'll be sure to post it on your behalf.

Wish me luck,