과외 내용 여기에 정리해서 각종 시험이랑 앞으로 필요할때 보실수 있게 공유합니다
- 변수 (Variable): 변수는 데이터를 저장하는 데 사용되는 이름이 붙은 메모리 공간입니다. 변수를 선언하고 값을 할당할 수 있습니다. 파이썬에서는 변수를 선언할 때 데이터의 타입을 명시할 필요가 없습니다. 예를 들어, 다음과 같이 변수를 선언하고 값을 할당할 수 있습니다:
my_variable = 10
| const trainData = preprocess(titanicTrain); | |
| const testData = preprocess(titanicTest); | |
| const cls = new RandomForestClassifier({ | |
| nEstimator: 100, | |
| }); | |
| cls.fit({ X: trainData.X, y: trainData.y }); | |
| const yPred = cls.predict(testData.X); |
| function getTitle(name) { | |
| // example of name: "Braund, Mr. Owen Harris" | |
| const rawTitle = name.split(' ')[1]; | |
| // TODO: fillna? | |
| if (rawTitle.indexOf('Mr') !== -1) { | |
| return 1; | |
| } else if (rawTitle.indexOf('Miss') !== -1) { | |
| return 2; | |
| } else if (rawTitle.indexOf('Mrs') !== -1) { | |
| return 3; |
| import { RandomForestClassifier } from 'kalimdor/ensemble'; // model to train | |
| import { accuracyScore } from 'kalimdor/metrics'; // measuring the training accuracy | |
| import titanicTrain from './train.json'; // train data | |
| import titanicTest from './test.json'; // test data | |
| import titanicYtrue from './ytrue.json'; // y true from test data |
| [ | |
| { | |
| "Survived": 0 | |
| }, | |
| { | |
| "Survived": 1 | |
| }, | |
| { | |
| "Survived": 0 | |
| }, |
| [ | |
| { | |
| "PassengerId": 892, | |
| "Pclass": 3, | |
| "Name": "Kelly, Mr. James", | |
| "Sex": "male", | |
| "Age": 34.5, | |
| "SibSp": 0, | |
| "Parch": 0, | |
| "Ticket": 330911, |
| [ | |
| { | |
| "PassengerId": 1, | |
| "Survived": 0, | |
| "Pclass": 3, | |
| "Name": "Braund, Mr. Owen Harris", | |
| "Sex": "male", | |
| "Age": 22, | |
| "SibSp": 1, | |
| "Parch": 0, |
| import scala.io.StdIn.{readLine, readInt} | |
| import scala.math._ | |
| import scala.collection.mutable.ArrayBuffer | |
| import java.io.PrintWriter | |
| import scala.io.Source | |
| object ScalaTutorial { | |
| def main(args: Array[String]) { | |
| var i = 0 | |
| do { |
| const workshopsList = this.props.store.filteredWorkshops.map( (workshop) => { | |
| let formattedRangeDate = getFormattedRangeDate(workshop.StartDate, workshop.EndDate, this.rageDateDelimeter); | |
| let maxSeats = workshop.maximum; | |
| let availables = workshop.maximum - workshop.BookingCount; | |
| let monthDate = getMonthDate(workshop.StartDate); | |
| }); |
| const workshopsList = this.props.store.filteredWorkshops.map( (workshop) => { | |
| let formattedRangeDate = getFormattedRangeDate(workshop.StartDate, workshop.EndDate, this.rageDateDelimeter); | |
| let maxSeats = workshop.maximum; | |
| let availables = workshop.maximum - workshop.BookingCount; | |
| let monthDate = getMonthDate(workshop.StartDate); | |
| }); |