text: import os
  import numpy as np
  import math
  import pandas as pd
  import sys
  import joblib
  from math import sqrt
  from sklearn.neural_network import MLPRegressor
  from sklearn import preprocessing
  
  base_path = os.path.dirname(os.path.abspath(__file__))
  #'''/home/arakka/visibility-china/preprocessing/src/features'''
  
  def main():
  
      if len(sys.argv) < 2:
       print ('Number of arguments:',len(sys.argv))
       print (str(sys.arg[1]))
       print ('Usage: ./train_model.py input_train_lcn')
       sys.exit(0)
  
      st=str(sys.argv[1])
      stn=st[0:4]
  
      #load data
      data = pd.read_csv(base_path+"/../../data/train_data/"+stn+".csv", sep=",")
      #split into input (X) and output (Y) variables
  #    X_train=data.loc[:, ["Month","Day","T_1000","RH_1000","U_1000","V_1000","W_1000","T_2m","RH_2m","U_10m","V_10m","W_10m","MSLP","PR","VIS","VIS_1"]].values
      X_train=data.loc[:, ["Year","Month","Day","FT","T_1000","RH_1000","U_1000","V_1000","W_1000","HGT","T_2m","RH_2m","U_10m","V_10m","W_10m","MSLP","PR","VIS","VIS_1"]].values
  #    X_train=data.loc[:, ["Year","Month","Day","FT","T_975","RH_975","U_975","V_975","W_975","T_1000","RH_1000","U_1000","V_1000","W_1000","HGT","T_2m","RH_2m","U_10m","V_10m","W_10m","MSLP","PR","VIS","VIS_1"]].values
      Y_train=data.loc[:,["VIS_METAR"]].values
      
      f1=open('./testfile', 'a+')
      if X_train.size < 10 or Y_train.size < 10:
          f1.write(stn + '\n')
          f1.close()
          exit()
  
      #set model
      clf = MLPRegressor(solver="adam",learning_rate_init=0.001,alpha=2,random_state=0,max_iter=10000)
      clf.fit(X_train,Y_train)
  
      # evaluate training error
      scr=clf.score(X_train,Y_train)
      print ("Score = %f " %scr)
  
      # Save with joblib
      dump_file = base_path+"/../../models/"+stn+".nn"
      joblib.dump(clf, dump_file)
  
      outfile = stn
      print ("%s was made." % outfile)
  
  if __name__ == "__main__":
      main()
                                             
  