Files
sdk/model_train_budget.go

193 lines
4.7 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the TrainBudget type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TrainBudget{}
// TrainBudget struct for TrainBudget
type TrainBudget struct {
// Accuracy is the largest accuracy drop allowed.
Accuracy *float64 `json:"accuracy,omitempty"`
// ECE is the largest calibration-error rise allowed.
Ece *float64 `json:"ece,omitempty"`
AdditionalProperties map[string]interface{}
}
type _TrainBudget TrainBudget
// NewTrainBudget instantiates a new TrainBudget object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewTrainBudget() *TrainBudget {
this := TrainBudget{}
return &this
}
// NewTrainBudgetWithDefaults instantiates a new TrainBudget object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewTrainBudgetWithDefaults() *TrainBudget {
this := TrainBudget{}
return &this
}
// GetAccuracy returns the Accuracy field value if set, zero value otherwise.
func (o *TrainBudget) GetAccuracy() float64 {
if o == nil || IsNil(o.Accuracy) {
var ret float64
return ret
}
return *o.Accuracy
}
// GetAccuracyOk returns a tuple with the Accuracy field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainBudget) GetAccuracyOk() (*float64, bool) {
if o == nil || IsNil(o.Accuracy) {
return nil, false
}
return o.Accuracy, true
}
// HasAccuracy returns a boolean if a field has been set.
func (o *TrainBudget) HasAccuracy() bool {
if o != nil && !IsNil(o.Accuracy) {
return true
}
return false
}
// SetAccuracy gets a reference to the given float64 and assigns it to the Accuracy field.
func (o *TrainBudget) SetAccuracy(v float64) {
o.Accuracy = &v
}
// GetEce returns the Ece field value if set, zero value otherwise.
func (o *TrainBudget) GetEce() float64 {
if o == nil || IsNil(o.Ece) {
var ret float64
return ret
}
return *o.Ece
}
// GetEceOk returns a tuple with the Ece field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainBudget) GetEceOk() (*float64, bool) {
if o == nil || IsNil(o.Ece) {
return nil, false
}
return o.Ece, true
}
// HasEce returns a boolean if a field has been set.
func (o *TrainBudget) HasEce() bool {
if o != nil && !IsNil(o.Ece) {
return true
}
return false
}
// SetEce gets a reference to the given float64 and assigns it to the Ece field.
func (o *TrainBudget) SetEce(v float64) {
o.Ece = &v
}
func (o TrainBudget) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TrainBudget) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Accuracy) {
toSerialize["accuracy"] = o.Accuracy
}
if !IsNil(o.Ece) {
toSerialize["ece"] = o.Ece
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TrainBudget) UnmarshalJSON(data []byte) (err error) {
varTrainBudget := _TrainBudget{}
err = json.Unmarshal(data, &varTrainBudget)
if err != nil {
return err
}
*o = TrainBudget(varTrainBudget)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "accuracy")
delete(additionalProperties, "ece")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTrainBudget struct {
value *TrainBudget
isSet bool
}
func (v NullableTrainBudget) Get() *TrainBudget {
return v.value
}
func (v *NullableTrainBudget) Set(val *TrainBudget) {
v.value = val
v.isSet = true
}
func (v NullableTrainBudget) IsSet() bool {
return v.isSet
}
func (v *NullableTrainBudget) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTrainBudget(val *TrainBudget) *NullableTrainBudget {
return &NullableTrainBudget{value: val, isSet: true}
}
func (v NullableTrainBudget) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTrainBudget) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}