| 29 | MutableOrdinalLogitState; |
| 30 | |
| 31 | AnyType |
| 32 | ordinal_logit_transition::run(AnyType& args) { |
| 33 | MutableOrdinalLogitState state = args[0].getAs<MutableByteString>(); |
| 34 | if (state.terminated || args[1].isNull() || args[2].isNull()) { |
| 35 | return args[0]; |
| 36 | } |
| 37 | double y = args[1].getAs<double>(); |
| 38 | MappedColumnVector x; |
| 39 | try { |
| 40 | MappedColumnVector xx = args[2].getAs<MappedColumnVector>(); |
| 41 | x.rebind(xx.memoryHandle(), xx.size()); |
| 42 | } catch (const ArrayWithNullException &e) { |
| 43 | return args[0]; |
| 44 | } |
| 45 | if (state.empty()) { |
| 46 | state.num_features = static_cast<uint16_t>(x.size()); |
| 47 | state.num_categories = args[4].getAs<uint16_t>(); |
| 48 | state.optimizer.num_coef = static_cast<uint16_t>(state.num_features + (state.num_categories-1)); |
| 49 | state.resize(); |
| 50 | if (!args[3].isNull()) { |
| 51 | OrdinalState prev_state = args[3].getAs<ByteString>(); |
| 52 | state = prev_state; |
| 53 | state.reset(); |
| 54 | } |
| 55 | } |
| 56 | state << OrdinalMutableState::tuple_type(x, y); |
| 57 | return state.storage(); |
| 58 | } |
| 59 | |
| 60 | // ------------------------------------------------------------------------ |
| 61 | |