Java代写 | Project Part 3: Visualize Your Algorithm

本次美国代写主要为Java图算法相关

Sample Visualization Library
In the project directory, I have included a file called Graph.java that allows you to draw a simple 2D
graph. Try downloading the file first and run the file by running “java Graph.java”. It will look something
like below. Since the points are generated randomly, it may not look exactly like below.

There are multiple parts to this library.
1. private static void createAndShowGui(List<DataPoint> data) : This is the main logic of the
visualization library. Currently this method generates the Graph object with the randomly
generated points and draws the graph elements.
2. protected void paintComponent(Graphics g) : You probably will not need to change any logic
here. This method draws the background, axis labels and the points. This is called automatically
by the swing library.
3. private void paintPoints(…) : This is the actual code that needs to be changed. This is where the
points are drawn.
4. public static void main(String args[]) : Currently the main method simply generates random
data points and passes it into createAndShowGui method.
TODOs
The main idea of this part of the project is to combine Part 2 of the project with the sample code
given. Once you understand the code, it should not be too difficult. Most of the instructions can be
found as TODOs within Graph.java
1. In the main method, make sure to change the input filename and pass in a K value of your
choice, or from user input.
2. Modify the Graph class’s constructor as follows.
a. Instantiate a KNNPredictor object with input K.
b. Run readData using titanic.csv and make sure to split the data into train and test, where
90% of the data is used for training and the remaining 10% is used for testing.
c. Set the Graph’s data variable to be equal to the output of readData
3. Now, within the paintPoints method, run test method on each of the TEST data points and
change the color of the points as follows. Do not paint the TRAIN data points.
a. If the label from the test method returns “1” and the label of the DataPoint is “1”, it is a
truePositive, so color it blue. (Color(0,0,255) )
b. If the label from the test method returns “1” and the label of the DataPoint is “0”, it is a
falsePositive, so color it cyan. (Color(0, 255, 255) )
c. If the label from the test method returns “0” and the label of the DataPoint is “1”, it is a
falseNegative, so color it yellow. (Color(255,255,0) )
d. If the label from the test method returns “0” and the label of the DataPoint is “0”, it is a
true negative, so color it red. (Color(255,0,0) )
e. Notice that if your test method requires access to the list of train data, you may have to
change KNNPredictor class to store the output of readData as a field before returning it.
4. Similar to Part 2 Display the precision and accuracy in a separate JPanel within the same JFrame.
Note: You can cross-check that the accuracy and precision with the colors of the points above.
5. Add an extra JPanel that displays the coordinates once you click on a point


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


blank

本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: itcsdx@outlook.com  微信:itcsdx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank

发表评论