eror

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #205349
    Ma’rup
    Participant

      dtf = read.csv(“Salary_Data.csv”)

      library(caTools)

      set.seed(123)

      split = sample.split(dtf$Salary, SplitRatio = 0,7)

      set_training = subset(dtf, split == TRUE)
      set_tes = subset(dtf, split == FALSE)

      regressor = lm(formula = dtf$Salary ~ dtf$YearsExperience,
      data = set_tes)

      y = predict(regressor, newdata = set_tes)

      # jika run
      # Warning message:
      # ‘newdata’ had 10 rows but variables found have 30 rows

      result = cbind(set_tes, y)

      # hasilnya tetep 30 row, kalo cuma ingin predict 10 row yang ada di set_tes aja gimana kak codingannya?
      # apakah ada perlakuan khusus?

      #205391
      Coach William
      Moderator

        Hi John,

        Saya tidak terlalu yakin dengan maksud kamu, cuma itu hanya warning saja hrsnya tidak masalah, tapi kok itu trainingnya pakai set tes ya? set trainingnya tidak pernah digunakan.
        Coba deh trainingnya pakai set training

        Regards

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.
      Shopping cart0
      There are no products in the cart!
      Continue shopping