Data file logo

Importing a data file

By Javier PĂ©rez, Artelnics.

You can use your favourite data files with Neural Designer.

Contents:

  1. Import data file wizard
  2. TXT, DAT and CSV files
  3. OpenOffice Calc ODS files & Microsoft Excel XLSX files
  4. Weka ARFF files

1. Import data file wizard

Once a project has been created, you can import a data file by clicking on the Import data file button at the Data set page. The following figure shows the Dataset page of Neural Editor where you can find Import data file button.

Dataset page screenshot
Dataset page.

By clicking on the "import data file" button, it shows up the Import data file wizard. This wizard contains the following two pages:

  1. The Select data file page.
  2. The Set file properties page.

The Select data file page allows you to select your data file. The data files supported are:

  • Text files (.txt).
  • Data files (.dat).
  • CSV files (.csv).
  • OpenOffice Calc files (.ods).
  • Microsoft Excel files (.xlsx).
  • Weka files (.arff).

The next figure shows a screenshot of Select data file page for data file server type.

Select data file page
Select data file page.

As we can see, this page is a file dialog wich contains:

  • Look in: the directory where you are looking in.
  • File name: the name of your data file.
  • Files of type: diferent file filters for suported files.

When you select a valid file, the next step is to click on the Next button in order to set file properties.

The Set file properties page allows you to check your data file and import the results to your project. You can preview your data file and set the file properties. The figure below shows a screenshot of Set file properties page.

Set file properties page
Set file properties page.

You can check Columns name and Rows label if there are any on your data file. You should select the Separator if it doesn't coincide with the separator of your data file. Also you should write the Missing values label. It must coincide with the missing values label of your data file. Import Data File will set the fields to recommended.

If all the properties are set up, click on Finish button. Now you can start to use your data with Neural Designer.

>Dataset page with the data from data file
Dataset page with the data from data file.

2. TXT, DAT and CSV files

Neural Designer works with .txt and .dat text files. Each line of the file is a data record and each record consists of one or more fields, separated by the same separator to all rows and lines.

A comma-separated values (CSV) file stores tabular data in plain text. Each line of the file is a data record and each record consists of one or more fields, separated by commas.

The following example represents a text data file (.txt or .dat). It has 11 rows, 2 columns and where the data is separated by spaces.

				-1.0 -0.84147 
				-0.8 -0.71736 
				-0.6 -0.56464
				-0.4 -0.38942
				-0.2 -0.19867
				0.0  0.00000
				0.2  0.19867
				0.4  0.38942
				0.6  0.56464
				0.8  0.71736
				1.0  0.84147
				

The image below is an example how to load the data from the example.

Import datafile text example
Import datafile text example.

In a CSV file the data from the previous example should be represented as follows.

				-1.0,-0.84147 
				-0.8,-0.71736 
				-0.6,-0.56464
				-0.4,-0.38942
				-0.2,-0.19867
				 0.0,0.00000
				 0.2,0.19867
				 0.4,0.38942
				 0.6,0.56464
				 0.8,0.71736
				 1.0,0.84147
				

In the next figure you can see how the Import data file wizard has recognized the comma separator.

Import datafile csv example
Import datafile csv example.

In the next example we add columns name to the first example. We add some missing values as NULL too.

				input output
				-1.0 -0.84147 
				-0.8 -0.71736 
				-0.6  NULL
				-0.4 -0.38942
				-0.2 -0.19867
				 0.0  0.00000
				 0.2  NULL
				 0.4  0.38942
				 0.6  0.56464
				 NULL 0.71736
				 1.0  0.84147
				

As we see in the next figure, the Import data file wizard has recognized the columns name, but we need to change the Missing values label to NULL.

Import datafile text columns example
Import datafile text columns example.

We also add a rows label to the data and we change the separator to a semicolon.

				label;input;output
				id1;-1.0;-0.84147 
				id2;-0.8;-0.71736 
				id3;-0.6;NULL
				id4;-0.4;-0.38942
				id5;-0.2,-0.19867
				id6;0.0;0.00000
				id7;0.2;NULL
				id8;0.4;0.38942
				id9;0.6;0.56464
				id10;NULL;0.71736
				id11;1.0;0.84147
				

When we import the text file, the Import data file wizard recognized the columns name, the rows label and the separator. As before we should change the Missing values label to "NULL".

Import datafile text rows example
Import datafile text rows example.

3. OpenOffice Calc ODS files & Microsoft Excel XLSX files

Import data file ods Import data file excel

An .ods is an open XML-based file format for spreadsheets. OpenOffice Calc works with .ods files.

An .xlsx is an Office Open XML Workbook file for spreadsheets. Microsoft Excel works with .xlsx files.

The next figures are an example of .ods and .xlsx files.

import data file ods preview
Open office calc.

Import data file excel preview
Microsoft excel.

As we can see, the import data file dialog shows a previsualization of the data set in order to realize that all is OK. The image below shows the Set file properties page with an excel example, but neural designer can update different types of files.

Import data file excel example
Import data file excel example.

As you see there are some new fields to set. You have to set the Sheet number where your data is. Also you have to set the Cell range where your data is. Import Data File will set the fields to recommended values.

Like a text file, you have to set the Columns name, Rows label and the Missing value label.

4. Weka ARFF files

Import data file arff

An ARFF (Attribute-Relation File Format) file is an text file that describes a list of instances sharing a set of attributes.

The next example is the content of a .arff dataset file.

				% 1. Title: Iris Plants Database
				% 
				% 2. Sources:
				%      (a) Creator: R.A. Fisher
				%      (b) Donor: Michael Marshall (MARSHALL%PLU@io.arc.nasa.gov)
				%      (c) Date: July, 1988
				% 
				@RELATION iris
				@ATTRIBUTE sepallength  NUMERIC
				@ATTRIBUTE sepalwidth   NUMERIC
				@ATTRIBUTE petallength  NUMERIC
				@ATTRIBUTE petalwidth   NUMERIC
				@ATTRIBUTE class        {Iris-setosa,Iris-versicolor,Iris-virginica}
				@DATA
				5.1,3.5,1.4,0.2,Iris-setosa
				4.9,3.0,1.4,0.2,Iris-setosa
				7.0,3.2,4.7,1.4,Iris-versicolor
				6.4,3.2,4.5,1.5,Iris-versicolor
				6.3,3.3,6.0,2.5,Iris-virginica
				5.8,2.7,5.1,1.9,Iris-virginica
				

In the next figure you see the Set file properties page for a .arff file.

Import data file arff example
Import data file arff example.

You dont have to set any file properties for a .arff file.