Comece agoraComece grátis

Para dentro da matriz

Você identificou seis valores distintos para EducationField. Mas suspeita que outros possam aparecer ao executar o modelo em novos dados. Para se preparar, você vai criar um índice de hashing com 50 termos. O pacote textrecipes e as divisões attrition_train e attrition_test já estão carregados.

Este exercicio faz parte do curso

Feature Engineering em R

Ver curso

Instruções do exercicio

  • Adicione uma etapa à receita que gere um índice dummy_hash para EducationField.
  • Prepare a receita.
  • Faça o bake da receita preparada.
  • Una a tabela assada da receita e os valores de EducationField em uma única tabela e imprima as primeiras 7 linhas, bem como as colunas 1 e da 18 à 20.

exercicio interativo prático

Tente este exercicio completando este código de exemplo.

recipe <- recipe(~EducationField, data = attrition_train) %>%
# Add a step to the recipe that generates a dummy_hash index for EducationField
  ___(EducationField, prefix = NULL, signed = FALSE, num_terms = 50L)

# Prepare the recipe
object <- recipe %>%
  ___

# Bake the prepped recipe
baked <- ___(object, new_data = attrition_test)

# Bind the baked recipe table and the EducationField values into one table
bind_cols(___, baked)[1:7,c(1,18:20)]
Editar e Executar Código