我是机器学习的初学者,我想建立一个预测房屋价格的模型。我通过爬行当地住房网站准备了一个数据集,它包含1000个样本,只有4个特征(纬度,经度,面积和房间数)。
我在sklearn中尝试过RandomForestRegressor和LinearSVR模型,但我无法正确训练模型,MSE超高。
MSE几乎等于90,000,000(价格范围的真实价值在5,000,000 - 900,000,000之间)
这是我的代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html ng-app='appModule'>
<head>
<title>Accordion</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.js"></script>
<link href="accordion.css" rel='stylesheet'>
</head>
<body ng-controller='SomeController' >
<accordion>
<expander class='expander'
ng-repeat='expander in expanders'
expander-title='expander.title'>
{{expander.text}}
</expander>
</accordion>
</body>
<script>
function SomeController($scope) {
$scope.expanders = [
{title: 'Click me to expand',
text: 'Hi there folks, I am the content that was hidden but is now shown.'},
{title: 'Click this',
text: 'I am even better text than you have seen previously'},
{title: 'No, click me!',
text: 'I am text that should be seen before seeing other texts'}
];
}
var appModule = angular.module('appModule', []);
appModule.directive('accordion', function() {
return {
restrict: 'EA',
replace: true,
transclude: true,
template: '<div ng-transclude></div>',
controller: function() {
var expanders = [];
this.gotOpened = function(selectedExpander) {
angular.forEach(expanders, function(expander) {
if (selectedExpander != expander) {
expander.showMe = false;
}
});
}
this.addExpander = function(expander) {
expanders.push(expander);
}
}
}
});
appModule.directive('expander', function(){
return {
restrict: 'EA',
replace: true,
transclude: true,
require: '^?accordion',
scope: { title:'=expanderTitle' },
template: '<div>' +
'<div class="title" ng-click="toggle()">{{title}}</div>' +
'<div class="body" ng-show="showMe" ng-transclude></div>' +
'</div>',
link: function(scope, element, attrs, accordionController) {
scope.showMe = false;
accordionController.addExpander(scope);
scope.toggle = function toggle() {
scope.showMe = !scope.showMe;
accordionController.gotOpened(scope);
}
}
}
});
</script>
</html>
我的数据集和功能数量存在问题吗?如何使用此类数据集构建预测模型?