Real-valued utilities

Posted by:
**
Pepe Lopis
**

Date: March 24, 2022 08:40AM

Dear all,

I wonder if there's a means to enter real-valued utilities in an SPMF file. My utilities are prices, that is, with two decimal places. I'm multipliying them all by 100 to transform them into integer numbers.

I've taken a look at a thread in which someone posted a version of FHM that works with float numbers, but I'm not sure if there's a general solution to the problem.

Thanks in advance.

I wonder if there's a means to enter real-valued utilities in an SPMF file. My utilities are prices, that is, with two decimal places. I'm multipliying them all by 100 to transform them into integer numbers.

I've taken a look at a thread in which someone posted a version of FHM that works with float numbers, but I'm not sure if there's a general solution to the problem.

Thanks in advance.

Posted by:
**
webmasterphilfv
**

Date: March 29, 2022 08:19AM

Good evening,

Yes, the most simple solution is to multiply values by 100 because most algorithms in SPMF takes integers as utility values.

However, as you noticed, some algorithms have been adapted to accept floats such as:

**FHM(float)**

I think that it is maybe the only one. But it is possible that there are others. If you need a specific algorithm to work with float and it is very important for you, it can maybe be done. It actually just require a bit of programming and testing to change integers by float. But obviously, I do not want to do it for all algorithms as it requires duplicating some code ...

Best regards,

Philippe

Yes, the most simple solution is to multiply values by 100 because most algorithms in SPMF takes integers as utility values.

However, as you noticed, some algorithms have been adapted to accept floats such as:

I think that it is maybe the only one. But it is possible that there are others. If you need a specific algorithm to work with float and it is very important for you, it can maybe be done. It actually just require a bit of programming and testing to change integers by float. But obviously, I do not want to do it for all algorithms as it requires duplicating some code ...

Best regards,

Philippe