@@ -8,7 +8,8 @@ import csv from 'csv-parser'
88import Table from 'cli-table3'
99import readlineSync from 'readline-sync'
1010
11-
11+ import singleFeatureProcess from './single-feature.js'
12+ import multiFeatureProcess from './multi-feature.js'
1213
1314
1415/**
@@ -161,54 +162,42 @@ async function previewData(filePath) {
161162 print ( '\n-----------------------------------------------------\n' )
162163 print ( 'Preview data: ' , filePath )
163164
164- await Promise . all ( [ readFileAsync ( path . join ( DATA_DIR , filePath ) ) ] )
165-
165+ await readFileAsync ( path . join ( DATA_DIR , filePath ) )
166166
167167 if ( readlineSync . keyInYNStrict ( chalk . green ( '\nContinue next process' ) ) ) {
168- dataIdentification ( )
168+ await dataIdentification ( )
169169 }
170170}
171171
172172
173173
174174
175- function dataIdentification ( ) {
175+ async function dataIdentification ( ) {
176176 print ( '\n-----------------------------------------------------\n' )
177- print ( 'Data identification!' )
178-
179- const feature = readlineSync . question ( 'Choose feature: ' )
180- const label = readlineSync . question ( 'Choose label: ' )
181-
182- if ( readlineSync . keyInYNStrict ( chalk . green ( '\nContinue process data' ) ) ) {
183- processing ( )
184- }
185- }
177+ print ( 'Data identification' )
186178
187179
180+ const answers = await inquirer . prompt ( [
181+ {
182+ type : 'list' ,
183+ name : 'type' ,
184+ message : 'Choose model type' ,
185+ choices : [
186+ '1. Single feature' ,
187+ '2. Multi feature'
188+ ]
189+ }
190+ ] )
188191
189-
190- function processing ( ) {
191- print ( '\n-----------------------------------------------------\n' )
192- print ( 'Model processing!' )
193- for ( let i = 1 ; i <= 20 ; i ++ ) {
194- print ( 'iteration: ' , i )
195- }
196-
197- if ( readlineSync . keyInYNStrict ( chalk . green ( '\nShow visualization' ) ) ) {
198- visualization ( )
192+ switch ( answers . type ) {
193+ case '1. Single feature' :
194+ singleFeatureProcess ( )
195+ break ;
196+ case '2. Multi feature' :
197+ multiFeatureProcess ( )
198+ break ;
199+ default :
200+ print ( 'Invalid input!' )
201+ break ;
199202 }
200203}
201-
202-
203-
204-
205-
206- function visualization ( ) {
207- print ( '\n-----------------------------------------------------\n' )
208- print ( 'Visualization here!' )
209- print ( 'Graph, chart, or whatever...' )
210-
211-
212- // 7
213- print ( 'Show the prove of linear equation is actually match with user data' )
214- }
0 commit comments