train.ex 2.5 KB

1234567891011121314151617181920212223242526272829303132
  1. defmodule Train do
  2. def data do
  3. opts = [
  4. model: :multinomial,
  5. storage: :file_system,
  6. file_path: "lib/medicine_dataset.txt"
  7. ]
  8. SimpleBayes.init(opts)
  9. |> SimpleBayes.train(:zebutal, "tension headaches")
  10. |> SimpleBayes.train(:dvita, "vitamin that helps your body absorb calcium and phosphorus")
  11. |> SimpleBayes.train(:tyneol, "treat mild to moderate pain from headaches, menstrual periods, toothaches, backaches, osteoarthritis, or cold, flu aches and pains and to reduce fever",weight: 0.6)
  12. |> SimpleBayes.train(:duraflu, "is used to temporarily treat cough, chest congestion, fever, body aches, and stuffy nose symptoms caused by the common cold, flu, or other breathing illnesses")
  13. |> SimpleBayes.train(:duraflu, "side effects: Dizziness, drowsiness, headache, nausea, nervousness, or trouble sleeping may occur")
  14. |> SimpleBayes.train(:aspirin, "reduce fever and relieve mild to moderate pain from conditions such as muscle aches, toothaches, common cold, and headache")
  15. |> SimpleBayes.train(:pamelor, "treat mental/mood problems such as depression")
  16. |> SimpleBayes.train(:diphenhist, "it is an antihistamine used to relieve symptoms of allergy, hay fever, and the common cold")
  17. |> SimpleBayes.train(:aleve, "headache, muscle aches, dental pain, menstrual cramps, or arthritis")
  18. |> SimpleBayes.train(:nuvigil, "narcolepsy and other sleep disorders, such as periods of stopped breathing during sleep (obstructive sleep apnea)")
  19. |> SimpleBayes.train(:indomethacin,"used to relieve pain, swelling, and joint stiffness caused by arthritis, gout, bursitis, and tendonitis")
  20. |> SimpleBayes.train(:ceftin, "Cefuroxime is used to treat a wide variety of bacterial infections")
  21. |> SimpleBayes.train(:norel, "common cold, flu, allergies, or other breathing illnesses (such as sinusitis, bronchitis)",weight: 0.6)
  22. |> SimpleBayes.train(:sinutab, "common cold, flu, allergies, or other breathing illnesses (such as sinusitis, bronchitis)",weight: 0.4)
  23. |> SimpleBayes.train(:benadryl, "allergy, hay fever, and the common cold. These symptoms include rash, itching, watery eyes, itchy eyes/nose/throat, cough, runny nose, and sneezing",weight: 0.6)
  24. |> SimpleBayes.train(:ibuprofen, "headache, dental pain, menstrual cramps, muscle aches, or arthritis")
  25. |> SimpleBayes.train(:zanamivir, "flu virus (influenza) it helps lessen symptoms (such as stuffy nose, cough, sore throat, fever/chills, headache, body aches, tiredness")
  26. |> SimpleBayes.train(:goto_doctor,"still",weight: 2)
  27. |> SimpleBayes.save()
  28. end
  29. end