mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2025-04-06 18:21:52 +00:00
Rename demo datasets and add Dataset suffix
This commit is contained in:
parent
84af842f04
commit
349ea16f01
@ -18,7 +18,7 @@ use Phpml\Dataset\CsvDataset;
|
|||||||
* Samples total: 214
|
* Samples total: 214
|
||||||
* Features per sample: 9.
|
* Features per sample: 9.
|
||||||
*/
|
*/
|
||||||
class Glass extends CsvDataset
|
class GlassDataset extends CsvDataset
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
@ -12,7 +12,7 @@ use Phpml\Dataset\CsvDataset;
|
|||||||
* Samples total: 150
|
* Samples total: 150
|
||||||
* Features per sample: 4.
|
* Features per sample: 4.
|
||||||
*/
|
*/
|
||||||
class Iris extends CsvDataset
|
class IrisDataset extends CsvDataset
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
@ -12,7 +12,7 @@ use Phpml\Dataset\CsvDataset;
|
|||||||
* Samples total: 178
|
* Samples total: 178
|
||||||
* Features per sample: 13.
|
* Features per sample: 13.
|
||||||
*/
|
*/
|
||||||
class Wine extends CsvDataset
|
class WineDataset extends CsvDataset
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
@ -4,13 +4,13 @@ declare (strict_types = 1);
|
|||||||
|
|
||||||
namespace tests\Phpml\Dataset\Demo;
|
namespace tests\Phpml\Dataset\Demo;
|
||||||
|
|
||||||
use Phpml\Dataset\Demo\Glass;
|
use Phpml\Dataset\Demo\GlassDataset;
|
||||||
|
|
||||||
class GlassTest extends \PHPUnit_Framework_TestCase
|
class GlassDatasetTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testLoadingWineDataset()
|
public function testLoadingWineDataset()
|
||||||
{
|
{
|
||||||
$glass = new Glass();
|
$glass = new GlassDataset();
|
||||||
|
|
||||||
// whole dataset
|
// whole dataset
|
||||||
$this->assertEquals(214, count($glass->getSamples()));
|
$this->assertEquals(214, count($glass->getSamples()));
|
@ -4,13 +4,13 @@ declare (strict_types = 1);
|
|||||||
|
|
||||||
namespace tests\Phpml\Dataset\Demo;
|
namespace tests\Phpml\Dataset\Demo;
|
||||||
|
|
||||||
use Phpml\Dataset\Demo\Iris;
|
use Phpml\Dataset\Demo\IrisDataset;
|
||||||
|
|
||||||
class IrisTest extends \PHPUnit_Framework_TestCase
|
class IrisDatasetTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testLoadingIrisDataset()
|
public function testLoadingIrisDataset()
|
||||||
{
|
{
|
||||||
$iris = new Iris();
|
$iris = new IrisDataset();
|
||||||
|
|
||||||
// whole dataset
|
// whole dataset
|
||||||
$this->assertEquals(150, count($iris->getSamples()));
|
$this->assertEquals(150, count($iris->getSamples()));
|
@ -4,13 +4,13 @@ declare (strict_types = 1);
|
|||||||
|
|
||||||
namespace tests\Phpml\Dataset\Demo;
|
namespace tests\Phpml\Dataset\Demo;
|
||||||
|
|
||||||
use Phpml\Dataset\Demo\Wine;
|
use Phpml\Dataset\Demo\WineDataset;
|
||||||
|
|
||||||
class WineTest extends \PHPUnit_Framework_TestCase
|
class WineDatasetTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testLoadingWineDataset()
|
public function testLoadingWineDataset()
|
||||||
{
|
{
|
||||||
$wine = new Wine();
|
$wine = new WineDataset();
|
||||||
|
|
||||||
// whole dataset
|
// whole dataset
|
||||||
$this->assertEquals(178, count($wine->getSamples()));
|
$this->assertEquals(178, count($wine->getSamples()));
|
@ -6,7 +6,7 @@ namespace tests\Phpml\Metric;
|
|||||||
|
|
||||||
use Phpml\Classification\SVC;
|
use Phpml\Classification\SVC;
|
||||||
use Phpml\CrossValidation\RandomSplit;
|
use Phpml\CrossValidation\RandomSplit;
|
||||||
use Phpml\Dataset\Demo\Iris;
|
use Phpml\Dataset\Demo\IrisDataset;
|
||||||
use Phpml\Metric\Accuracy;
|
use Phpml\Metric\Accuracy;
|
||||||
use Phpml\SupportVectorMachine\Kernel;
|
use Phpml\SupportVectorMachine\Kernel;
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ class AccuracyTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testAccuracyOnDemoDataset()
|
public function testAccuracyOnDemoDataset()
|
||||||
{
|
{
|
||||||
$dataset = new RandomSplit(new Iris(), 0.5, 123);
|
$dataset = new RandomSplit(new IrisDataset(), 0.5, 123);
|
||||||
|
|
||||||
$classifier = new SVC(Kernel::RBF);
|
$classifier = new SVC(Kernel::RBF);
|
||||||
$classifier->train($dataset->getTrainSamples(), $dataset->getTrainLabels());
|
$classifier->train($dataset->getTrainSamples(), $dataset->getTrainLabels());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user