how to add cross term in logistic regression model?
I have a data of 2000 (say locations of different fruits grow) and 10000 (say factors responsile for growth of fruits). And I also know that there are 20 different types of fruits in these locations. I want to built a logistic model for this dataset such that if I get a new location then my model should be able to define the type of fruit.
log_reg_model = LogisticRegression(max_iter=500,penalty='l2',solver='newton-cg')
log_reg_model.fit(neighborhoodClass,target)
The shape of neighborhoodClass is (2000, 10000) and the target is an integer array of 20 integer labels of length 2000.
I believe that some of these fruit types are dependent on each other that means If I see a fruit A at location l1 then there is a high chance that I also observe fruit B in nearby location to l1. That means fruit A and fruit B co-habitat in near proximity regions. Is there anyway I can add cross terms in logistic regression models to capture the neighborhood features? So that when I see a new location with different features my model should be able to tell the type of the fruit?
Thanks.
Topic logistic-regression
Category Data Science