C++代写:ELEC362 Linear Regression Application

实现一个可视化的Linear Regression应用程序,展示图表。

Linear Regression

The project

Task 1

Design and implement a Qt-based GUI linear regression application. The application reads a file of data points, given by two columns one for x coordinates and one for y coordinates, then calculates the best linear fit of the form:

y = ax + b

Where “a” and “b” are parameters to be determined by the application. You are requested to work on the GUI only. The regression part of the application will be done by GSL library. Binaries for linking Qt to the library will be provided for both Windows and Mac OS on VITAL. The documentation of the linear regression part of the library can be found in this link. You are not asked to study the theory behind linear regression. All what you are expected to do is to know how to implement the function from the library into your application, and how to display its return or output to the user.

The application will be used to do linear regression for one file at a time.

In addition to the core functionality mentioned above, the application:

  • Should plot the data and the fitted curve on a single graph in the application.
  • Should allow the user to choose the thickness and the colour of the plotted curve using 3 different means.
  • Should give the user the option to do the fitting with and without a constant term.
  • Should be validated, in the report, by using a test dataset as an input to the application obtaining the fitted line, then comparing the fit to a linear fit by another programme such as MATLAB or MS EXCEL (No linking to EXCEL or MATLAB is required in the application).
  • Should be able to deal with potential run-time errors, which the developers should identify.

Task 2

Modify the application to have a bilinear fit mode, where the fit of the dataset should be done using a piecewise function of the form:

y = a1x + b1  x < x0
y = a2x + b2  x > x0

The application should calculate (a1,b1,a2,b2) in additional to automatically identify the point x0 which gives the best possible fit. This part if meant to be as a challenge and as a result no hints will be given on how to do this part. An example of a bilinear fit is shown in figure 1.

It is an expectation from everyone to consult Qt documentation to find any functions or classes that might be useful for the implementation of this project. Finally, you should make the programme as professional as possible. Imagine this project as a real-life project given to you.

Approach to be followed

The following steps will help you to have a good design and implementation of the application:

  • Start by conducting a background overview of the available programs that for linear regression and how they are used. This will give you a feeling of what a professional design is and a better understanding of the core functionality. Make sure the practical notes given in the lectures ae taken into consideration in your design and implementation.
  • Follow the incremental model by breaking the implementation of the application into smaller parts, where every part is designed, implemented and tested before other parts are implemented.
  • Make sure your application is working perfectly before moving to task 2.

Note for Mac OS users: You can develop the application and write the report based on Mac version of the app. The application will be tested and marked on a Windows machine. You are strongly recommended to verify that your app works as it should on a windows machine before submission, to avoid any potential cross-platform issue, if you have any problems, please let me know.

The deliverables

Every submission should consist of the project’s files + brief report (Do NOT submit GSL library’s files as I will compile your project with local GSL files on my machine). The report must have the student’s name and ID number. The report does not need an introduction or a conclusion, it must have a cover page, and includes the following sections:

  • How the programme works (explain the idea of the algorithm, include a block diagram).
  • User instructions (how should the user use it)
  • Testing and verification attempts.
  • Overall notes (optional): in this section you can highlight any special features in your design or implementation of the application. Or you can mention any major issue you faced how you overcome it. If you left this section empty you will not lose any marks.
  • Appendix: headers+ source files (must be in machine readable format).

Industrial Relevance

Designing a GUI for a C++ library is a routine task for software developers at MATLAB (where some linear algebra packages are embedded), National Instruments (MultiSim where libraries for solving ordinary differential equations are embedded), ANSYS (where all their products such as Fluent and CFX include libraries related to meshing and nonlinear solvers), CST studio suite, and the list goes on..

Many software development projects are entirely based on building GUI to famous libraries, examples include Elmer FEM software, Gmsh, and ParaView.