<commit_before>type PartialFeatureResults
    name::String
    values::Vector{Float64}
    responses::Vector{Float64}
end

function partials(model::ClassificationModel, x::Matrix{Float64}, feature::Int)
    x_copy = copy(x)
    values = quantile(x[:,feature], [0.01:0.01:0.99])
    responses = zeros(length(values))
    for i=1:length(values)
        x_copy[:,feature] = values[i]
        responses[i] = mean(predict_probs(model, x_copy)[:,2])
    end
    PartialFeatureResults(@sprintf("Feature %d", feature), values, responses)
end

function partials(x::Matrix{Float64}, y::Vector, feature::Int, opts::ClassificationModelOptions)
    model = fit(x, y, opts)
    partials(model, x, feature)
end

function partials(model::DataFrameModel, data::DataFrame, feature::Symbol)
    data_copy = copy(data)
    values = quantile(data[feature], [0.01:0.01:0.99])
    responses = zeros(length(values))
    for i=1:length(values)
        data_copy[feature] = values[i]
        responses[i] = mean(predict_probs(model, data_copy)[:,2])
    end
    PartialFeatureResults(string(feature), values, responses)
end

function partials(data::DataFrame, target::Symbol, feature::Symbol, opts::ClassificationModelOptions)
    model = fit(data, target, opts)
    partials(model, data, feature)
end

function Gadfly.plot(results::PartialFeatureResults)<commit_msg>now can do partials on regression models<commit_after>type PartialFeatureResults
    name::String
    values::Vector{Float64}
    responses::Vector{Float64}
end

function partials(model::ClassificationModel, x::Matrix{Float64}, feature::Int)
    x_copy = copy(x)
    values = quantile(x[:,feature], [0.01:0.01:0.99])
    responses = zeros(length(values))
    for i=1:length(values)
        x_copy[:,feature] = values[i]
        responses[i] = mean(predict_probs(model, x_copy)[:,2])
    end
    PartialFeatureResults(@sprintf("Feature %d", feature), values, responses)
end

function partials(x::Matrix{Float64}, y::Vector, feature::Int, opts::ClassificationModelOptions)
    model = fit(x, y, opts)
    partials(model, x, feature)
end

function partials(model::DataFrameModel, data::DataFrame, feature::Symbol)
    data_copy = copy(data)
    values = quantile(data[feature], [0.01:0.01:0.99])
    responses = zeros(length(values))
    for i=1:length(values)
        data_copy[feature] = values[i]
        if typeof(model.model)<:ClassificationModel
            responses[i] = mean(predict_probs(model, data_copy)[:,2])
        elseif typeof(model.model)<:RegressionModel
            responses[i] = mean(predict(model, data_copy))
        end
    end
    PartialFeatureResults(string(feature), values, responses)
end

function partials(data::DataFrame, target::Symbol, feature::Symbol, opts::SupervisedModelOptions)
    model = fit(data, target, opts)
    partials(model, data, feature)
end

function Gadfly.plot(results::PartialFeatureResults)
{'fraction_non_alphanumeric': 0.13869625520110956, 'fraction_numerical': 0.020804438280166437, 'mean_word_length': 4.960743801652892, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2795581', 'n_tokens_mistral': 929, 'n_tokens_neox': 920, 'n_words': 177}