Uploaded image for project: 'Apache MADlib'
  1. Apache MADlib
  2. MADLIB-952

Type error in elastic net

    XMLWordPrintableJSON

Details

    Description

      First check the columns which are text or character using the following code:

      select
      column_name, data_type
      from
      information_schema.columns
      where table_schema='analytics'
      and table_name='discharge_train'
      and data_type in ('character varying','text')

      It gave me the following result.

      "cohort_assignment";"text"
      "providergender";"character varying"
      "locationname";"character varying"
      "patientkey";"character varying"

      Then this is the code I used for elastic net.

      DROP TABLE IF EXISTS analytics.elastic_net_logistic;
      SELECT madlib.elastic_net_train( 'analytics.discharge_train',
      'analytics.elastic_net_train_result',
      'readmission < 0',
      '*',
      'binomial',
      0.6,
      0.02,
      TRUE,
      NULL,
      'fista',
      '',
      'totalemergencyvisits_in_current_visit , totalgimvisits_in_current_visit ,
      totalcardiologyvisits_in_current_visit , total_time_in_medical_short_inpatient ,
      totalacupulmonaryvisits_in_current_visit , current_complain_ ,
      total_current_dea_ciii, curr_rx_gen_lactated_ringers ,patientkey ,
      totalobservationvisits_in_current_visit, total_unitsvisited_before_admission ,
      totalpcuneurovisits_in_current_visit , totalicuvisits_in_current_visit ,curr_rx_gen_oxycodone_w_ ,
      total_time_in_medical_short_in_er , totalmfmvisits_in_current_visit ,
      totalmedsurgvisits_in_current_visit , hospitalaccountrecord, inpatientadmitdatetime ,totalongvisits_in_current_visit,
      no_null_days_btw_admissions,cohort_assignment,locationname,providergender,patientkey',
      10000,
      1e-6
      );

      If you check in exlcuded list of variables, at the very last I have excluded the character or text variables.

      It still gives me this error.

      Elastic Net error: All columns to be included in the

      independent variables should be of the same numeric type.

      Context: Traceback (most recent call last):

      PL/Python function "elastic_net_train", line 23, in <module>

      return elastic_net.elastic_net_train(**globals())

      PL/Python function "elastic_net_train", line 308, in elastic_net_train

      PL/Python function "elastic_net_train", line 427, in analyze_input_str

      PL/Python function "elastic_net_train"

      Please note I have also tried by dropping all the character or text variables and then passing it to elastic net code. And it still gives me the same error.

      Attachments

        Activity

          People

            Unassigned Unassigned
            fmcquillan Frank McQuillan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: