Click here to Skip to main content
15,881,898 members
Articles / Programming Languages / C#
Article

Universal Framework for Science and Engineering - Part 2: Regression

Rate me:
Please Sign up or sign in to vote.
4.77/5 (19 votes)
11 Jul 20067 min read 51.1K   5K   76   2
An article on universal scalable engineering framework applications.

The main form of the framework

Introduction

This article is written based on request from readers for concrete examples of the Universal Framework for Science and Engineering. We shall consider a class of scientific problems related to regression. I'll show how this framework solves problems in astronomy, control systems, and navigation.

Background

The common approaches to the framework have been considered in my previous article. Now, I'll consider application of the framework to regression. Nonlinear regression in statistics is the problem of fitting a model.

y = f(x,\theta) + \varepsilon

to multidimensional x,y data, where f is a nonlinear function of x, with regression parameter θ.

Nonlinear regression operates with selections. This software implements two methods of manipulation with selections. The first method loads selection iteratively, i.e., step by step. The second one loads selection at once.

The architecture of nonlinear regression software that uses iterative regression is presented in the following scheme:

Architecture

Let us describe the components of this scheme. The iterator provides data-in selections x and y. The y is the Left part of fitting the equations. The Transformation corresponds to the nonlinear function f, and generates the Left part of the fitting model. The Processor coordinates all the actions and corrects the Regression parameters.

The architecture of the software with loading selection at once is presented in the following scheme:

Architecture

The processor compares Calculated parameters with Selection, calculates residuals, and then corrects Regression parameters. In these two schemas, the Iterator, Selection, and others are not concrete components. They are components that implement interfaces of Iterator, Selection etc. For example, a Camera component may implement the Selection interface. Here, I'll consider examples in brief. A more profound description is available in the documentation of this project.

Example 1. Herzsprung-Rassel Diagram

One of the most valuable methods of astronomy is statistics. The statistics enables scientists to find different relations between the parameters of the stars. The discovery of the relation between an absolute star magnitude and its brightness is very valuable in astronomy. This relation is known as the Herzsprung-Rassel diagram. I'll reproduce this discovery using a recent star catalogue Hipparcos and my framework. This research corresponds to the following combination of components of the framework:

Architecture

Let us shortly describe them. First one is a Data that has the Architecture icon. The editor of the properties of this component is presented in the following picture:

Architecture

It contains the SQL query for the necessary selection. The Filter Architecture component performs additional filtration for selection. It contains the logical expression:

Architecture

This expression means that the parallax exceeds b (b = 200), and the error of parallax is more than three times exceeding the parallax error. The Formula and Regression components enable us to use the necessary formulas. The Processor component is a coordinator of the regression process. Its editor of properties is presented below:

Architecture

It enables us to set the regression parameters and the regression equations. If you click the Iterate button, then the Processor shall perform an iteration of nonlinear regression. The components Circles and Graph enable us to indicate the Herzsprung-Rassel diagram and its regression curve (see the picture at the beginning of this document). If you wish to try this example, you need to install Tycho and the Hipparcos database and then open this file using the framework.

Example 2. Determination of the 6D Position of a 3D Object by Photos

If we have a several sets of photos of a 3D object, we can obtain its 6D position. In this example, this problem is solved by the following way. From the photos and virtual cameras, we obtain the contours of the object as it is presented in the following picture:

Architecture

The red contour corresponds to the photo, and the blue one corresponds to the virtual 3D Object. Then, we perform a virtual 6D motion of the object to match both contours. As a result, we have a matching that looks like:

Architecture

For solving this problem, we will use the following combination of components:

Architecture

A profound description of this combination is contained in section 8.4 of the product documentation. Here, I'll describe it in brief. The Plane component corresponds to a binary file of the 3D object. I use a special file format for it. Three virtual cameras Architecture draw this object using OpenGL graphics (the graphics driver may be easily changed). The editor for the properties of the camera looks like:

Architecture

The Architecturecomponent constructs the contours. We also have the State Frame moved reference frame for a virtual motion formula component for motion equations. Click here to download this sample.

Example 3. Identification of Parameters of a Control System

This example is devoted to the situation where we have a control system with the following transfer function:

Transfer finction

Parameters Regression parameters are unknown, but we have an experimental gain-frequency characteristic. We wish to define the unknown parameters. Then, we shall construct the following scheme:

Regression parameters

The profound description of this picture can be found at section 8.3 of the product documentation. Here, I'll describe the meaning of these components. The Graph is an experimental gain-frequency characteristic. The Graph has a class Series which implements three interfaces: selection, a one variable function, and a source of vectors. It is connected by an Regression parameters arrow as a selection, by Regression parameters arrow as a one variable function, and by Regression parametersas a source of vectors. Its editor of properties is represented in the following picture:

Regression parameters

It has two selections: abscissas and ordinates. It is clear why it is a one variable function. It also contains two vectors: a vector of abscissas, and a vector of ordinates. The Formula contains an analytical formula:

Regression formula

of the power gain-frequency characteristic (we use a, b, c instead of Time constants for technical reasons). The argument p of this formula is a vector of abscissas of the Graph. You can find it at the properties editor of Formula.

Regression formula

So, the result of the calculation is a vector of point-wise calculation of the analytical formula. The editor for properties of Processor is represented below:

Regression formula

Its left part corresponds to the defined parameters. The middle and right parts mean that we wish to match the Formula_1 of Formula to the selection X of the Graph. Every click of the Iterate button performs an iteration. Suppose that we have performed a set of iterations. Now, we wish to compare the obtained gain-frequency characteristic with the experimental one. We should set the p argument as the independent variable (Time):

Regression formula

Now, we use the Graph as a one variable formula:

Regression formula

Then, we use the Indication component.

Regression formula

In this picture, the red curve is a theoretic gain-frequency characteristic, and the green curve is an experimental one. In other words, the red curve corresponds to:

Regression formula

and the green curve corresponds to:

Regression formula

Click here to download this sample.

Points of interests

I love this product. Working with it is like holding a good hunting rifle or a bow, or reading a good math or history book. It is a mania. Recently, I read books about quantum chemistry and the physical aspects of epilepsy. I want to insert facilities of these branches of science into this framework. I also wish to find shadowy matters in the space (I began this work in 1996). My son and I wish to do a generator of realistic computer games. Recently, I searched Google for "Herzsprung-Rassel Diagram" and found my project. When I upload this project, I've the same feeling a painter has on the opening of his exhibition.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Architect
Russian Federation Russian Federation
Ph. D. Petr Ivankov worked as scientific researcher at Russian Mission Control Centre since 1978 up to 2000. Now he is engaged by Aviation training simulators http://dinamika-avia.com/ . His additional interests are:

1) Noncommutative geometry

http://front.math.ucdavis.edu/author/P.Ivankov

2) Literary work (Russian only)

http://zhurnal.lib.ru/editors/3/3d_m/

3) Scientific articles
http://arxiv.org/find/all/1/au:+Ivankov_Petr/0/1/0/all/0/1

Comments and Discussions

 
GeneralDEBUG ERROR Pin
Matii yan13-Sep-06 5:52
Matii yan13-Sep-06 5:52 
GeneralRe: DEBUG ERROR Pin
Petr Ivankov13-Sep-06 19:17
Petr Ivankov13-Sep-06 19:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.