Example #1
0
    def run_features(self, database, npz_type):
        print('Features Iuri Claro (recarga_lag_plano)...'
              )  #OK#ok features_iuri.py
        try:
            loaded = np.load('{}_features_iuri_vm.npz'.format(npz_type))
            try:
                x = loaded['x_comp']
            except:
                x = loaded['x']
            y = loaded['y']
        except:
            print("Generating features...")
            analysis = AnalysisFeaturesIuri(database)
            y, x = analysis.gen_features()
            np.savez_compressed('{}_features_iuri_vm.npz'.format(npz_type),
                                x=x,
                                y=y)
        '''Features Especificas da CLARO!!!
		print('Features Iuri lag Claro (recharge_claro)...') # ok features_recarga_claro_iuri_1.py
		try:
			loaded = np.load('{}_features_iuri_lag_vm.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:   
			print("Generating features...")                   
			analysis = AnalysisFeaturesIuriLag(database)
			x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_iuri_lag_vm.npz'.format(npz_type), x_comp=x_comp)
			x = np.concatenate([x, x_comp], axis=1)

		print('Features Recarga...') #NOVAS FEATURES!!!
		try:
			loaded = np.load('{}_features_recarga_vm.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:
			print("Generating features...")
			analysis = AnalysisRecharge(database)
			x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_recarga_vm.npz'.format(npz_type), x_comp=x_comp)
			x = np.concatenate([x, x_comp], axis=1)

		print('Features Servicos clientes...') #ok client_services.py
		try:
			loaded = np.load('{}_features_servico_clientes_vm.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:	
			print("Generating features...")
			analysis = FeaturesServicosdoCliente(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_servico_clientes_vm.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)

		'''

        print(
            'Features Recarga com lag, media, desvio (recharge_lagmeddesv) ...'
        )  #OK #ok mundiale_features/features/claro_mig/features_recarga_lag_vivo.py
        try:
            loaded = np.load(
                '{}_features_recarga_lag_vivo_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = AnalysisRechargeLagVivo(database)
            x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_recarga_lag_vivo_vm.npz'.format(npz_type),
                x_comp=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Recarga Intervalos (recharge_interval)...'
              )  #OK#ok features_recarga_intervalos_temp.py
        try:
            loaded = np.load(
                '{}_features_recarga_intervalos_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = AnalysisRechargeTimeIntervals(database)
            x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_recarga_intervalos_vm.npz'.format(npz_type),
                x_comp=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Servicos Recarga (recarga)...'
              )  #OK#ok features/all_datasets/client_recargaserv.py
        try:
            loaded = np.load(
                '{}_features_servico_recarga_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesServicosdeRecarga(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_servico_recarga_vm.npz'.format(npz_type),
                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Mailing...')  #OK features/all_datasets/mailing.py
        try:
            loaded = np.load('{}_features_mailing_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesMailing(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_mailing_vm.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Dia / Mes...')  #OK#ok dia_mes.py
        try:
            loaded = np.load('{}_features_dia_mes_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesDiaMes(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_dia_mes_vm.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Dia / Semana...')  #OK#ok dia_semana.py
        try:
            loaded = np.load('{}_features_dia_semana_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesDiaSemana(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_dia_semana_vm.npz'.format(npz_type), x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print(
            'Features Clientes (localizacao) ...'
        )  #OK#ok ~/mundiale_features/features/all_datasets/features_clientes.py
        try:
            loaded = np.load('{}_features_clientes_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesClientes(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_clientes_vm.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Ligacoes Clientes (qtdcalls)...'
              )  #OK#ok features_ligacoes_clientes.py
        try:
            loaded = np.load(
                '{}_features_ligacoes_clientes_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesLicacoesClientes(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_ligacoes_clientes_vm.npz'.format(npz_type),
                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Hora...')  #OK#ok hora.py
        try:
            loaded = np.load('{}_features_hora_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesHora(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_hora_vm.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Idade (idade) ...'
              )  #OK  ~/mundiale_features/features/all_datasets/vivo_idade.py
        try:
            loaded = np.load('{}_features_vivo_idade_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesIdade(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_vivo_idade_vm.npz'.format(npz_type), x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        return y, x
    def run_features(self, database, npz_type):
        print('Features Iuri Claro...')
        try:
            loaded = np.load('{}_features_iuri.npz'.format(npz_type))
            try:
                x = loaded['x_comp']
            except:
                x = loaded['x']
            y = loaded['y']
        except:
            print("Generating features...")
            analysis = AnalysisFeaturesIuri(database)
            y, x = analysis.gen_features()
            np.savez_compressed('{}_features_iuri.npz'.format(npz_type),
                                x=x,
                                y=y)

        print('Features Iuri lag Claro...')

        try:
            loaded = np.load('{}_features_iuri_lag.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = AnalysisFeaturesIuriLag(database)
            x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_iuri_lag.npz'.format(npz_type),
                                x_comp=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Recarga...')
        try:
            loaded = np.load('{}_features_recarga.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = AnalysisRecharge(database)
            x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_recarga.npz'.format(npz_type),
                                x_comp=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Recarga Intervalos...')
        try:
            loaded = np.load(
                '{}_features_recarga_intervalos.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = AnalysisRechargeTimeIntervals(database)
            x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_recarga_intervalos.npz'.format(npz_type),
                x_comp=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Servicos Recarga...')
        try:
            loaded = np.load(
                '{}_features_servico_recarga.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesServicosdeRecarga(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_servico_recarga.npz'.format(npz_type), x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Mailing...')
        try:
            loaded = np.load('{}_features_mailing.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesMailing(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_mailing.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Servicos clientes...')
        try:
            loaded = np.load(
                '{}_features_servico_clientes.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesServicosdoCliente(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_servico_clientes.npz'.format(npz_type), x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Dia / Mes...')
        try:
            loaded = np.load('{}_features_dia_mes.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesDiaMes(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_dia_mes.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Dia / Semana...')
        try:
            loaded = np.load('{}_features_dia_semana.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesDiaSemana(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_dia_semana.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Clientes...')
        try:
            loaded = np.load('{}_features_clientes.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesClientes(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_clientes.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Ligacoes Clientes...')
        try:
            loaded = np.load(
                '{}_features_ligacoes_clientes.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesLicacoesClientes(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_ligacoes_clientes.npz'.format(npz_type), x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Fidelidade Prezao...')
        try:
            loaded = np.load(
                '{}_features_fidelidade_prezao.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeatureFidelidadePrezao(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_fidelidade_prezao.npz'.format(npz_type), x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Hora...')
        try:
            loaded = np.load('{}_features_hora.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesHora(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_hora.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Quantidade Prezao...')
        try:
            loaded = np.load('{}_features_qtd_prezao.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesQtdPrezao(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_qtd_prezao.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Whitelist...')
        try:
            loaded = np.load('{}_features_whitelist.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']

            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesWhitelist(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_whitelist.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        return y, x
Example #3
0
	def run_features(self, database, npz_type):
		individualfeatures={} #dictionary with individual features.
		
		print('Features Iuri Claro (recarga_lag_plano)...') #ok features_iuri.py
		try:
			loaded=np.load('{}_features_iuri.npz'.format(npz_type))
			try:
				x = loaded['x_comp']
			except:
				x = loaded['x']
			y = loaded['y']
		except:         
			print("Generating features...")               
			analysis = AnalysisFeaturesIuri(database)
			y, x = analysis.gen_features()
			np.savez_compressed('{}_features_iuri.npz'.format(npz_type), x=x, y=y)
		
		individualfeatures['recargalagplano']=x
		
		print('Features Iuri lag Claro (recharge_claro)...') # ok features_recarga_claro_iuri_1.py
		try:
			loaded = np.load('{}_features_iuri_lag.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:   
			print("Generating features...")                   
			analysis = AnalysisFeaturesIuriLag(database)
			x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_iuri_lag.npz'.format(npz_type), x_comp=x_comp)
			x = np.concatenate([x, x_comp], axis=1)
		individualfeatures['recharge_claro']=x_comp

#		print('Features Recarga...') #NOVAS FEATURES!!!
#		try:
#			loaded = np.load('{}_features_recarga.npz'.format(npz_type))
#			try:
#				x_comp = loaded['x_comp']
#			except:
#				x_comp = loaded['x']			
#			x = np.concatenate([x, x_comp], axis=1)
#		except:
#			print("Generating features...")
#			analysis = AnalysisRecharge(database)
#			x_comp = analysis.gen_features()
#			np.savez_compressed('{}_features_recarga.npz'.format(npz_type), x_comp=x_comp)
#			x = np.concatenate([x, x_comp], axis=1)

#		print('Features COf. VAR (plans2)...') features_planos_coef_var.py 
#		try:
#			loaded = np.load('{}_features_planos_coef_var.npz'.format(npz_type))
#			try:
#				x_comp = loaded['x_comp']
#			except:
#				x_comp = loaded['x']			
#			x = np.concatenate([x, x_comp], axis=1)
#		except:
#			print("Generating features...")
#			analysis = AnalysisCoefVar(database)
#			x_comp = analysis.gen_features()
#			np.savez_compressed('{}_features_planos_coef_var.npz'.format(npz_type), x_comp=x_comp)
#			x = np.concatenate([x, x_comp], axis=1)

		

		print('Features Recarga com lag, media, desvio (recharge_lagmeddesv) ...')  #ok mundiale_features/features/claro_mig/features_recarga_lag_vivo.py
		try:
			loaded = np.load('{}_features_recarga_lag_vivo.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:
			print("Generating features...")
			analysis = AnalysisRechargeLagVivo(database)
			x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_recarga_lag_vivo.npz'.format(npz_type), x_comp=x_comp)
			x = np.concatenate([x, x_comp], axis=1)
		individualfeatures['recharge_lagmeddesv']=x_comp

		

		print('Features Recarga Intervalos (recharge_interval)...')  #ok features_recarga_intervalos_temp.py
		try:
			loaded = np.load('{}_features_recarga_intervalos.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:
			print("Generating features...")
			analysis = AnalysisRechargeTimeIntervals(database)
			x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_recarga_intervalos.npz'.format(npz_type), x_comp=x_comp)
			x = np.concatenate([x, x_comp], axis=1)
		individualfeatures['recharge_interval']=x_comp
		
		print('Features Servicos Recarga (recarga)...') #ok features/all_datasets/client_recargaserv.py
		try:
			loaded = np.load('{}_features_servico_recarga.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except: 
			print("Generating features...")
			analysis = FeaturesServicosdeRecarga(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_servico_recarga.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)
                individualfeatures['recarga']=x_comp
                
		print('Features Mailing...')
		try:
			loaded = np.load('{}_features_mailing.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except :
			print("Generating features...")
			analysis = FeaturesMailing(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_mailing.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)
                individualfeatures['mailing']=x_comp

		print('Features Servicos clientes...') #ok client_services.py
		try:
			loaded = np.load('{}_features_servico_clientes.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:	
			print("Generating features...")
			analysis = FeaturesServicosdoCliente(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_servico_clientes.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)
		x_servico_clientes=x_comp
                individualfeatures['servico_clientes']=x_comp		

		print('Features Dia / Mes...') #ok dia_mes.py
		try:
			loaded = np.load('{}_features_dia_mes.npz'.format(npz_type)) 
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:
			print("Generating features...")
			analysis = FeaturesDiaMes(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_dia_mes.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)
                individualfeatures['dia_mes']=x_comp
	
		print('Features Dia / Semana...') #ok dia_semana.py
		try:
			loaded = np.load('{}_features_dia_semana.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:	
			print("Generating features...")
			analysis = FeaturesDiaSemana(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_dia_semana.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)
                individualfeatures['dia_semana']=x_comp


		print('Features Clientes (localizacao) ...') #ok ~/mundiale_features/features/all_datasets/features_clientes.py
		try:
			loaded = np.load('{}_features_clientes.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:
			print("Generating features...")
			analysis = FeaturesClientes(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_clientes.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)
                individualfeatures['localizacao']=x_comp
		
		print('Features Ligacoes Clientes (qtdcalls)...') #ok features_ligacoes_clientes.py
		try:
			loaded = np.load('{}_features_ligacoes_clientes.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:
			print("Generating features...")
			analysis = FeaturesLicacoesClientes(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_ligacoes_clientes.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)
                individualfeatures['qtdcalls']=x_comp

		
		print('Features Fidelidade Prezao (fidelidade)...') #ok ~/mundiale_features/features/all_datasets/fidelidade_prezao.py
		try:
			loaded = np.load('{}_features_fidelidade_prezao.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:	
			print("Generating features...")
			analysis = FeatureFidelidadePrezao(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_fidelidade_prezao.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)
                individualfeatures['fidelidade']=x_comp
		
		print('Features Hora...') #ok hora.py
		try:
			loaded=np.load('{}_features_hora.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:
			print("Generating features...")
			analysis = FeaturesHora(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_hora.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)
                individualfeatures['hora']=x_comp
		
		print('Features Quantidade Prezao (prezao) ...') #ok ~/mundiale_features/features/all_datasets/qtd_prezao.py
		try:
			loaded=np.load('{}_features_qtd_prezao.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:
			print("Generating features...")
			analysis = FeaturesQtdPrezao(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_qtd_prezao.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)
                individualfeatures['prezao']=x_comp

		
		print('Features Whitelist...') #ok ~/mundiale_features/features/all_datasets/whitelist.py
		try:
			loaded = np.load('{}_features_whitelist.npz'.format(npz_type)) 
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			

			x = np.concatenate([x, x_comp], axis=1)
		except:
			print("Generating features...")
			analysis = FeaturesWhitelist(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_whitelist.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)
			
                individualfeatures['whitelist']=x_comp

                individualfeatures['tudo']=x


#		individualfeatures=(x_recargalagplano,x_features_iuri_lag,x_recarga_lag_vivo,x_recharge_interval,x_recarga,x_mailing,x_servico_clientes,x_dia_mes,x_dia_semana,x_clientes,x_qtdcalls,x_fidelidade,x_hora,x_prezao,x_whitelist)				
		return y, individualfeatures
    def run_features(self,
                     database,
                     npz_type,
                     useplans=False,
                     usehistoric=False):
        print('Labels...')
        try:
            loaded = np.load('{}_labels.npz'.format(npz_type))
            y = loaded['y']
        except:
            print("Generating features...")
            analysis = FeaturesLabel(database)
            y = analysis.gen_features()
            np.savez_compressed('{}_labels.npz'.format(npz_type), y=y)

        s = y.shape[0]
        x = y.reshape((s, 1))
        x = x * 0
        #		print y

        print('Features Iuri lag Claro...')

        try:
            loaded = np.load('{}_features_iuri_lag.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = AnalysisFeaturesIuriLag(database)
            x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_iuri_lag.npz'.format(npz_type),
                                x_comp=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        ''' Essas features pioram os resultados
                print('Features Recarga com lag, media, desvio (recharge_lagmeddesv) ...')  
                try:
                        loaded = np.load('{}_features_recarga_lag_vivo.npz'.format(npz_type))
                        try:
                                x_comp = loaded['x_comp']
                        except:
                                x_comp = loaded['x']                    
                        x = np.concatenate([x, x_comp], axis=1)
                except:
                        print("Generating features...")
                        analysis = AnalysisRechargeLagVivo(database)
                        x_comp = analysis.gen_features()
                        np.savez_compressed('{}_features_recarga_lag_vivo.npz'.format(npz_type), x_comp=x_comp)
                        x = np.concatenate([x, x_comp], axis=1)
		'''

        print('Features Recarga...')
        try:
            loaded = np.load('{}_features_recarga.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = AnalysisRecharge(database)
            x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_recarga.npz'.format(npz_type),
                                x_comp=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Recarga Intervalos...')
        try:
            loaded = np.load(
                '{}_features_recarga_intervalos.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = AnalysisRechargeTimeIntervals(database)
            x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_recarga_intervalos.npz'.format(npz_type),
                x_comp=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Servicos Recarga...')
        try:
            loaded = np.load(
                '{}_features_servico_recarga.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesServicosdeRecarga(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_servico_recarga.npz'.format(npz_type), x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Mailing...')
        try:
            loaded = np.load('{}_features_mailing.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesMailing(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_mailing.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Servicos clientes...')
        try:
            loaded = np.load(
                '{}_features_servico_clientes.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesServicosdoCliente(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_servico_clientes.npz'.format(npz_type), x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        '''
		print('Features Dia / Mes...')
		try:
			loaded = np.load('{}_features_dia_mes.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:
			print("Generating features...")
			analysis = FeaturesDiaMes(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_dia_mes.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)

		print('Features Dia / Semana...')
		try:
			loaded = np.load('{}_features_dia_semana.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:	
			print("Generating features...")
			analysis = FeaturesDiaSemana(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_dia_semana.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)

		'''
        print('Features Clientes...')
        try:
            loaded = np.load('{}_features_clientes.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesClientes(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_clientes.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Ligacoes Clientes...')
        try:
            loaded = np.load(
                '{}_features_ligacoes_clientes.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesLicacoesClientes(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_ligacoes_clientes.npz'.format(npz_type), x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Fidelidade Prezao...')
        try:
            loaded = np.load(
                '{}_features_fidelidade_prezao.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeatureFidelidadePrezao(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_fidelidade_prezao.npz'.format(npz_type), x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        '''
		print('Features Hora...')
		try:
			loaded=np.load('{}_features_hora.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:
			print("Generating features...")
			analysis = FeaturesHora(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_hora.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)

		'''
        print('Features Quantidade Prezao...')
        try:
            loaded = np.load('{}_features_qtd_prezao.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesQtdPrezao(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_qtd_prezao.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Whitelist...')
        try:
            loaded = np.load('{}_features_whitelist.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']

            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesWhitelist(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_whitelist.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        if usehistoric == True:
            print('Features Historic...')
            try:
                loaded = np.load('{}_features_historic.npz'.format(npz_type))
                try:
                    x_comp = loaded['x_comp']
                except:
                    x_comp = loaded['x']

                x = np.concatenate([x, x_comp], axis=1)
            except:
                print("Generating features...")
                analysis = AnalysisHistoric(database)
                x_comp = analysis.gen_features()
                np.savez_compressed(
                    '{}_features_historic.npz'.format(npz_type), x=x_comp)
                x = np.concatenate([x, x_comp], axis=1)

        if useplans == True:
            print('Features Coef Var...')
            try:
                loaded = np.load('{}_features_coef_var.npz'.format(npz_type))
                try:
                    x_comp = loaded['x_comp']
                except:
                    x_comp = loaded['x']

                x = np.concatenate([x, x_comp], axis=1)
            except:
                print("Generating features...")
                analysis = AnalysisCoefVar(database, 'files3_claro_mig')
                x_comp = analysis.gen_features()
                np.savez_compressed(
                    '{}_features_coef_var.npz'.format(npz_type), x=x_comp)
                x = np.concatenate([x, x_comp], axis=1)

        return y, x
Example #5
0
    def run_features(self, database, npz_type):
        individualfeatures = {}  #dictionary with individual features.

        print('Features Iuri Vivo (recarga_lag_plano)...'
              )  #ok features_iuri.py
        try:
            loaded = np.load('{}_features_iuri_vm.npz'.format(npz_type))
            try:
                x = loaded['x_comp']
            except:
                x = loaded['x']
            y = loaded['y']
        except:
            print("Generating features...")
            analysis = AnalysisFeaturesIuri(database)
            y, x = analysis.gen_features()
            np.savez_compressed('{}_features_iuri_vm.npz'.format(npz_type),
                                x=x,
                                y=y)

        individualfeatures['recargalagplano'] = x

        print('Features Iuri lag Vivo ...'
              )  # ok features_recarga_claro_iuri_1.py
        try:
            loaded = np.load('{}_features_iuri_lag_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = AnalysisFeaturesIuriLag(database)
            x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_iuri_lag_vm.npz'.format(npz_type),
                                x_comp=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        individualfeatures['recharge_claro'] = x_comp

        #		print('Features Recarga...') #NOVAS FEATURES!!!
        #		try:
        #			loaded = np.load('{}_features_recarga_vm.npz'.format(npz_type))
        #			try:
        #				x_comp = loaded['x_comp']
        #			except:
        #				x_comp = loaded['x']
        #			x = np.concatenate([x, x_comp], axis=1)
        #		except:
        #			print("Generating features...")
        #			analysis = AnalysisRecharge(database)
        #			x_comp = analysis.gen_features()
        #			np.savez_compressed('{}_features_recarga_vm.npz'.format(npz_type), x_comp=x_comp)
        #			x = np.concatenate([x, x_comp], axis=1)

        print(
            'Features Recarga com lag, media, desvio (recharge_lagmeddesv) ...'
        )  #ok mundiale_features/features/claro_mig/features_recarga_lag_vivo.py
        try:
            loaded = np.load(
                '{}_features_recarga_lag_vivo_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = AnalysisRechargeLagVivo(database)
            x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_recarga_lag_vivo_vm.npz'.format(npz_type),
                x_comp=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        individualfeatures['recharge_lagmeddesv'] = x_comp

        print('Features Recarga Intervalos (recharge_interval)...'
              )  #ok features_recarga_intervalos_temp.py
        try:
            loaded = np.load(
                '{}_features_recarga_intervalos_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = AnalysisRechargeTimeIntervals(database)
            x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_recarga_intervalos_vm.npz'.format(npz_type),
                x_comp=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        individualfeatures['recharge_interval'] = x_comp

        print('Features Servicos Recarga (recarga)...'
              )  #ok features/all_datasets/client_recargaserv.py
        try:
            loaded = np.load(
                '{}_features_servico_recarga_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesServicosdeRecarga(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_servico_recarga_vm.npz'.format(npz_type),
                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        individualfeatures['recarga'] = x_comp

        print('Features Mailing...')
        try:
            loaded = np.load('{}_features_mailing_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesMailing(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_mailing_vm.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        individualfeatures['mailing'] = x_comp

        print('Features Servicos clientes...')  #ok client_services.py
        try:
            loaded = np.load(
                '{}_features_servico_clientes_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesServicosdoCliente(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_servico_clientes_vm.npz'.format(npz_type),
                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        x_servico_clientes = x_comp
        individualfeatures['servico_clientes'] = x_comp

        print('Features Dia / Mes...')  #ok dia_mes.py
        try:
            loaded = np.load('{}_features_dia_mes_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesDiaMes(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_dia_mes_vm.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        individualfeatures['dia_mes'] = x_comp

        print('Features Dia / Semana...')  #ok dia_semana.py
        try:
            loaded = np.load('{}_features_dia_semana_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesDiaSemana(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_dia_semana_vm.npz'.format(npz_type), x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        individualfeatures['dia_semana'] = x_comp

        print(
            'Features Clientes (localizacao) ...'
        )  #ok ~/mundiale_features/features/all_datasets/features_clientes.py
        try:
            loaded = np.load('{}_features_clientes_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesClientes(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_clientes_vm.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        individualfeatures['localizacao'] = x_comp

        print('Features Ligacoes Clientes (qtdcalls)...'
              )  #ok features_ligacoes_clientes.py
        try:
            loaded = np.load(
                '{}_features_ligacoes_clientes_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesLicacoesClientes(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_ligacoes_clientes_vm.npz'.format(npz_type),
                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        individualfeatures['qtdcalls'] = x_comp

        print('Features Hora...')  #ok hora.py
        try:
            loaded = np.load('{}_features_hora_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesHora(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_hora_vm.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        individualfeatures['hora'] = x_comp

        individualfeatures['tudo'] = x

        return y, individualfeatures
Example #6
0
    def run_features(self,
                     database,
                     npz_type,
                     useplans=True,
                     usehistoric=True):
        '''
		print('Features Iuri Claro (recarga_lag_plano)...') #OK#ok features_iuri.py
		try:
			loaded=np.load('{}_features_iuri_vm.npz'.format(npz_type))
			try:
				x = loaded['x_comp']
			except:
				x = loaded['x']
			y = loaded['y']
		except:         
			print("Generating features...")               
			analysis = AnalysisFeaturesIuri(database)
			y, x = analysis.gen_features()
			np.savez_compressed('{}_features_iuri_vm.npz'.format(npz_type), x=x, y=y)
		'''
        print('Labels...')
        try:
            loaded = np.load('{}_labels_vm.npz'.format(npz_type))
            y = loaded['y']
        except:
            print("Generating features...")
            analysis = FeaturesLabel(database)
            y = analysis.gen_features()
            np.savez_compressed('{}_labels_vm.npz'.format(npz_type), y=y)

        s = y.shape[0]
        x = y.reshape((s, 1))
        x = x * 0
        '''features da claro migracao!
#		print('Features Iuri lag Claro (recharge_claro)...') # ok features_recarga_claro_iuri_1.py
#		try:
#			loaded = np.load('../{}_features_iuri_lag_vm.npz'.format(npz_type))
#			try:
#				x_comp = loaded['x_comp']
#			except:
#				x_comp = loaded['x']			
#			x = np.concatenate([x, x_comp], axis=1)
#		except:   
#			print("Generating features...")                   
#			analysis = AnalysisFeaturesIuriLag(database)
#			x_comp = analysis.gen_features()
#			np.savez_compressed('../{}_features_iuri_lag_vm.npz'.format(npz_type), x_comp=x_comp)
#			x = np.concatenate([x, x_comp], axis=1)
		'''

        print('Features Recarga...')  #NOVAS FEATURES!!!
        try:
            loaded = np.load('../{}_features_recarga_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = AnalysisRecharge(database)
            x_comp = analysis.gen_features()
            np.savez_compressed(
                '../{}_features_recarga_vm.npz'.format(npz_type),
                x_comp=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        '''


#		print('Features COf. VAR (plans2)...') features_planos_coef_var.py 
#		try:
#			loaded = np.load('../{}_features_planos_coef_var_vm.npz'.format(npz_type))
#			try:
#				x_comp = loaded['x_comp']
#			except:
#				x_comp = loaded['x']			
#			x = np.concatenate([x, x_comp], axis=1)
#		except:
#			print("Generating features...")
#			analysis = AnalysisCoefVar(database)
#			x_comp = analysis.gen_features()
#			np.savez_compressed('../{}_features_planos_coef_var_vm.npz'.format(npz_type), x_comp=x_comp)
#			x = np.concatenate([x, x_comp], axis=1)

#		print('Features Servicos clientes...') #ok client_services.py
#		try:
#			loaded = np.load('{}_features_servico_clientes_vm.npz'.format(npz_type))
#			try:
#				x_comp = loaded['x_comp']
#			except:
#				x_comp = loaded['x']			
#			x = np.concatenate([x, x_comp], axis=1)
#		except:	
#			print("Generating features...")
#			analysis = FeaturesServicosdoCliente(database)
#			y_comp, x_comp = analysis.gen_features()
#			np.savez_compressed('{}_features_servico_clientes_vm.npz'.format(npz_type), x=x_comp)
#			x = np.concatenate([x, x_comp], axis=1)

		'''
        print(
            'Features Recarga com lag, media, desvio (recharge_lagmeddesv) ...'
        )  #OK #ok mundiale_features/features/claro_mig/features_recarga_lag_vivo.py

        try:
            loaded = np.load(
                '{}_features_recarga_lag_vivo_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = AnalysisRechargeLagVivo(database)
            x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_recarga_lag_vivo_vm.npz'.format(npz_type),
                x_comp=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Recarga Intervalos (recharge_interval)...'
              )  #OK#ok features_recarga_intervalos_temp.py
        try:
            loaded = np.load(
                '{}_features_recarga_intervalos_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = AnalysisRechargeTimeIntervals(database)
            x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_recarga_intervalos_vm.npz'.format(npz_type),
                x_comp=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Servicos Recarga (recarga)...'
              )  #OK#ok features/all_datasets/client_recargaserv.py
        try:
            loaded = np.load(
                '{}_features_servico_recarga_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesServicosdeRecarga(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_servico_recarga_vm.npz'.format(npz_type),
                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Mailing...')  #OK features/all_datasets/mailing.py
        try:
            loaded = np.load('{}_features_mailing_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesMailing(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_mailing_vm.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        '''
		print('Features Dia / Mes...') #OK#ok dia_mes.py
		try:
			loaded = np.load('{}_features_dia_mes_vm.npz'.format(npz_type)) 
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:
			print("Generating features...")
			analysis = FeaturesDiaMes(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_dia_mes_vm.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)

		print('Features Dia / Semana...') #OK#ok dia_semana.py
		try:
			loaded = np.load('{}_features_dia_semana_vm.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:	
			print("Generating features...")
			analysis = FeaturesDiaSemana(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_dia_semana_vm.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)

		'''
        print(
            'Features Clientes (localizacao) ...'
        )  #OK#ok ~/mundiale_features/features/all_datasets/features_clientes.py
        try:
            loaded = np.load('{}_features_clientes_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesClientes(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed('{}_features_clientes_vm.npz'.format(npz_type),
                                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        print('Features Ligacoes Clientes (qtdcalls)...'
              )  #OK#ok features_ligacoes_clientes.py
        try:
            loaded = np.load(
                '{}_features_ligacoes_clientes_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesLicacoesClientes(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_ligacoes_clientes_vm.npz'.format(npz_type),
                x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)
        '''
		print('Features Hora...') #OK#ok hora.py
		try:
			loaded=np.load('{}_features_hora_vm.npz'.format(npz_type))
			try:
				x_comp = loaded['x_comp']
			except:
				x_comp = loaded['x']			
			x = np.concatenate([x, x_comp], axis=1)
		except:
			print("Generating features...")
			analysis = FeaturesHora(database)
			y_comp, x_comp = analysis.gen_features()
			np.savez_compressed('{}_features_hora_vm.npz'.format(npz_type), x=x_comp)
			x = np.concatenate([x, x_comp], axis=1)


		'''
        print('Features Idade (idade) ...'
              )  #OK  ~/mundiale_features/features/all_datasets/vivo_idade.py
        try:
            loaded = np.load('{}_features_vivo_idade_vm.npz'.format(npz_type))
            try:
                x_comp = loaded['x_comp']
            except:
                x_comp = loaded['x']
            x = np.concatenate([x, x_comp], axis=1)
        except:
            print("Generating features...")
            analysis = FeaturesIdade(database)
            y_comp, x_comp = analysis.gen_features()
            np.savez_compressed(
                '{}_features_vivo_idade_vm.npz'.format(npz_type), x=x_comp)
            x = np.concatenate([x, x_comp], axis=1)

        if usehistoric == True:
            print('Features Historic...')
            try:
                loaded = np.load(
                    '{}_features_historic_vm.npz'.format(npz_type))
                try:
                    x_comp = loaded['x_comp']
                except:
                    x_comp = loaded['x']

                x = np.concatenate([x, x_comp], axis=1)
            except:
                print("Generating features...")
                analysis = AnalysisHistoric(database)
                x_comp = analysis.gen_features()
                np.savez_compressed(
                    '{}_features_historic_vm.npz'.format(npz_type), x=x_comp)
                x = np.concatenate([x, x_comp], axis=1)

        if useplans == True:
            print('Features Coef Var...')
            try:
                loaded = np.load(
                    '{}_features_coef_var_vm.npz'.format(npz_type))
                try:
                    x_comp = loaded['x_comp']
                except:
                    x_comp = loaded['x']

                x = np.concatenate([x, x_comp], axis=1)
            except:
                print("Generating features...")
                analysis = AnalysisCoefVar(database, 'files3_vivo_mig')
                x_comp = analysis.gen_features()
                np.savez_compressed(
                    '{}_features_coef_var_vm.npz'.format(npz_type), x=x_comp)
                x = np.concatenate([x, x_comp], axis=1)

        return y, x