Fundamentals of Computer Science I (CS151.01 2006F)
[Skip to Body]
Primary:
[Front Door]
[Syllabus]
[Glance]
[Search]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
[Reading]
[Lab]
[Homework]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Projects]
[Readings]
Reference:
[Scheme Report (R5RS)]
[Scheme Reference]
[DrScheme Manual]
Related Courses:
[CSC151.02 2006F (Davis)]
[CSCS151 2005S (Stone)]
[CSC151 2003F (Rebelsky)]
[CSC153 2004S (Rebelsky)]
Summary: We explore further techniques for visualizing a simple multivariate data set.
Contents:
a. We'll be working in both DrScheme and GIMP, so open a new DrScheme window and a new GIMP window. In the GIMP, open a ScriptFu console. In that console, load our course GIMP library.
(load "/home/rebelsky/Web/Courses/CS151/2006F/Examples/gimp.scm")
b. If you have not done so already, make the file us1.txt
as described in
the previous lab.
a. Make a copy of datavis.scm.
b. Scan through that file to make sure that you understand the purpose of the various procedures. (The preprocess procedure is the most important one.)
c. As most of you noted on the first day exploring data visualization, it's a pain to manually preprocess the data from the file. Hence, the preprocess procedure should do it for you.
d. Define a list of data points with
(define data-points (preprocess "/home/username/Desktop/us1.txt"))
a. Return to the previous lab and complete any exercises you had not previously completed.
b. Make sure that the plot procedures you wrote in the previous
laboratory (and any other related procedures) are in your library for
this laboratory (datavis.scm).
a. Expand each vector in data-points by adding a
GNP-per-capita value.
b. Write a procedure, (vmax vecs pos), that, given a list
of vectors, vecs, and a position, pos, finds
the largest value at position pos in each vector. For
example,
> (define vectors (list (vector 1 2 4 8) (vector 2 2 2 2) (vector 0 5 0 5))) > (vmax vectors 0) 2 > (vmax vectors 1) 5 > (vmax vectors 2) 4 > (vmax vectors 3) 8
c. Write a similar procedure, (vmin vecs pos), that computes
a corresponding minimum value.
d. Write a procedure, (vshift! vecs pos amt), that adds
amt to the value at position pos in
each vector in vecs and returns the modified list.
e. Write a procedure, (vscale! vecs pos amt), that multiplies
by amt the value at position pos in each vector
in vecs and returns the modified list.
f. Add the following procedure to your library for this lab
(define normalize
(lambda (vecs pos)
(let* ((maxval (vmax vecs pos))
(minval (vmin vecs pos))
(scale (- maxval minval)))
(vscale! (vshift! vecs pos (- minval)) pos (/ 1 scale)))))
g. Normalize the values in data-points. For example, you
might write,
(normalize data-points 0) (normalize data-points 1) (normalize data-points 2) (normalize data-points 3)
h. Rewrite plot to accept normalized values.
i. Graph the values in the vector with
(map (lambda (point) (plot img point)) data-points)
Now that all of the values are normalized, you can use any of the values
as the x value, any of the values as the y value, and any of the values
as the color value or radius. Write a variant of plot that
makes different choices about the index of each.
http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2006F/History/Labs/more-multivariate-visualization.html.
[Skip to Body]
Primary:
[Front Door]
[Syllabus]
[Glance]
[Search]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
[Reading]
[Lab]
[Homework]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Projects]
[Readings]
Reference:
[Scheme Report (R5RS)]
[Scheme Reference]
[DrScheme Manual]
Related Courses:
[CSC151.02 2006F (Davis)]
[CSCS151 2005S (Stone)]
[CSC151 2003F (Rebelsky)]
[CSC153 2004S (Rebelsky)]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Thu Nov 30 21:43:04 2006.
The source to the document was last modified on Wed Nov 29 09:23:17 2006.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2006F/Labs/more-multivariate-visualization.html.
You may wish to
validate this document's HTML
;
;
http://creativecommons.org/licenses/by-nc/2.5/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.