File: utest-interface-fcm.cpp

package info (click to toggle)
python-pyclustering 0.10.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 11,128 kB
  • sloc: cpp: 38,888; python: 24,311; sh: 384; makefile: 105
file content (33 lines) | stat: -rwxr-xr-x 906 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*!

@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause

*/


#include <gtest/gtest.h>

#include <pyclustering/interface/fcm_interface.h>
#include <pyclustering/interface/pyclustering_package.hpp>

#include "samples.hpp"
#include "utenv_utils.hpp"


using namespace pyclustering;


TEST(utest_interface_fcm, fcm_api) {
    dataset_ptr data = simple_sample_factory::create_sample(SAMPLE_SIMPLE::SAMPLE_SIMPLE_01);
    std::shared_ptr<pyclustering_package> sample = pack(*data);
    std::shared_ptr<pyclustering_package> centers = pack(dataset({ { 3.7, 5.5 },{ 6.7, 7.5 } }));

    pyclustering_package * fcm_result = fcm_algorithm(sample.get(), centers.get(), 2.0, 0.001, 200);
    ASSERT_NE(nullptr, fcm_result);
    ASSERT_EQ(fcm_package_indexer::FCM_PACKAGE_SIZE, fcm_result->size);

    delete fcm_result;
    fcm_result = nullptr;
}