



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Operating Systems (CSCI-4210) --- A Project Report
Jinbo Bi [email protected] Department of Mathematical Sciences Rensselaer Polytechnic Institute
Basic Idea The nearest point algorithm (NPA) is used to find the two closest points in two convex sets as shown in Figure 1. In this example, the convex sets denoted respectively as and are the convex hull of the points 1 to 5, and the convex hull of the points 6 to 9. The NPA problem is stated as finding a point from and a point from V such that the two points are as close as possible. In Figure 1, the u and are such two points. The core algorithm of NPA can be found in [1, 2]. In this project, the NPA is implemented by breaking it into three threads. Assume that NPA can run on a parallel computing system, this implementation is expected to run faster than does the usual way. The first two threads are each used to iterate through one of the convex sets. The third thread is used for event handling. When the program is running, every time the user types in a character whose function has been pre-specified in a particular set of characters, an event will occur. No GUI has been established for this implementation by this moment. However, the event handling is still carried out by an appropriate interface.
ˆ v ˆ
Introduction As a graduate student in the department of mathematics, I’m interested in solving a family of interesting data mining problems that can be formulated as mathematical optimization problems. Particularly for this project, binary classification problems are investigated. Given a bunch of sample points with some of them belonging to a class ( ) and all remaining points belonging to another class ( V ), the goal of classification is to find the best decision rule to separate the two classes of points. The best decision boundary can be constructed by finding the two closest points in the two convex hulls generated respectively using the two sets of points. Thus, it is actually a NPA problem. Usually solving this kind of problems, (if it has been formulated as a specific sort of optimization problems), needs to use matrix decomposition techniques as done in solving classic support vector machine approaches. It will be computationally very expensive and slow. One way to improve it is to break down the optimization problem into some iterative procedures in order to use fast iterative algorithms. Nearest point algorithm (NPA) is one
u^ ˆ
v^ ˆ
x
of the iterative algorithms. Based on previous research, NPA can find a solution very fast. The question of whether or not it is scalable on large data sets is left for further research. In this project, an effort has been made to implement the NPA in a parallel way with at least two threads running simultaneously although threading is not necessary for the implementation of a NPA. We are not aware of any attempts on speeding up a NPA in terms of its implementation as parallel computing based on the current literature. Hence it will be a cool idea if the algorithm can be efficiently broken down into several threads and each part can be parallel distributed. Although the current implementation may not produce such an efficient decomposition, it is oriented towards this direction. Part of the algorithm computation is not an issue related to OS, such as computing values of a kernel function, and thus is omitted in this report. See [1, 2] for more complete description.
Algorithm and Data Structure The algorithm contains the following steps:
(A reader from the OS area does not have to know a lot about member functions such as “check_optimality”, “min_sort” and “update”. They are basically not related to OS, but they are the fundamental codes for a NPA algorithm. These functions will be called in the thread function named “Execute”.)
vector
member function initialize -- initializes the uu, uv, and vv values in order to start running NPA.
member function comput_value -- computes the function value as specified in [1, 2] Algorithm 1 pl and ql.
member function value_sort –- saves pl and ql values in the “checker” vector, and then sorts those values and stores the indices in xhat in the ascending order.
member function check_optimality –- computes the formula
member function min_sort –- this function calls the functions comput_value, value_sort, and check_optimality together to finish optimality evaluation and identify a xhat, the point violating optimality conditions.
member function compute_norm –- computes the norm of a vector, no matter for u , v or xhat.
member function update -- if optimality is not met, it means the current points u and v are not optimal yet, so update u or v using the xhat found in min_sort.
member function compute_b – computes the intercept term b needed in the classification function because the function does not only need u and v but also an offset b.
member function Npa_Thread –- This is important for OS class, which repeatedly calls “min_sort” and “update” functions based on the specific situations to perform the NPA algorithm. This function will be called when a thread is generated.
member function NPA(const NPA& copy); class operator NPA& operator = (const NPA& rhs);
public: char* logFile;
class constructor NPA()
class destructor ~NPA();
member function HANDLE Execute –- this function creates a thread and calls the function Npa_Thread().
member function get_u –- interface to return u member function get_v –- interface to return v member function get_intercept –- interface to return b
The program provides the following functions:
Please input which data file you’d like to handle: toytrain.txt Please indicate how many iterations you'd like to run: 1 Please provide the percentage of points made up the nearest points:
Please testify what kind of kernel you want to use: 2 Please supply kernel parameter value:
Please specify which file the result will be stored in: toy.mod
An example is the following command line npatest toy.mod toytrain.txt toytest.txt toy.out 2 It tests the model “toy.mod” on the data stored in the “toytest.txt” file, and results will be saved in “toy.out”. The program uses polynomial kernel (indicated by the number 2). Remember the kernel_type must be consistent to the kernel type used in the npa.exe program where the model is generated by training on data “toytrain.txt”. Otherwise it produces a contradiction.