Handling 'category' for LightGBM models

### Describe the bug

We should be able to convert some columns in the type 'category' in a DataFrame and let the LightGBM model handle it by itself.

### Steps/Code to Reproduce

```python
import pandas as pd
import numpy as np
from lightgbm import LGBMClassifier
from sklearn.pipeline import Pipeline
from sklearn.compose import ColumnTransformer
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.preprocessing import FunctionTransformer

# Load data
url = "https://web.stanford.edu/class/archive/cs/cs109/cs109.1166/stuff/titanic.csv"
data = pd.read_csv(url)

# Drop Name and other non-numeric non-categorical columns
data = data.drop(columns=['Name'])

# Define a transformer to convert specific columns to category type
def convert_to_category(X):
    categorical_cols = X.select_dtypes(include=['object', 'bool']).columns.tolist()
    X[categorical_cols] = X[categorical_cols].astype('category')
    return X

# Train/test split
X_train, X_test, y_train, y_test = train_test_split(
    data.drop("Survived", axis=1), data["Survived"], random_state=42
)

# Preprocessing for numerical data: standardization and missing value imputation
numerical_transformer = Pipeline(steps=[
    ('imputer', SimpleImputer(strategy='mean')),
    ('scaler', StandardScaler())
])

# We create the preprocessor stage of final pipeline
# Each transformer is a three-element tuple
# (name, transformer, columns)
preprocessor = ColumnTransformer(
    transformers = [
        ('num', numerical_transformer, ['Pclass', 'Age', 'Siblings/Spouses Aboard', 'Parents/Children Aboard', 'Fare']),
    ],
    remainder='passthrough'  # This means unprocessed columns are dropped
)

# Convert object columns to categorical using FunctionTransformer
to_category_transformer = FunctionTransformer(func=convert_to_category, validate=False, check_inverse=False)

# Define the model 
model = LGBMClassifier()

# Bundle preprocessing and modeling code in a pipeline
clf = Pipeline(steps=[
    ('to_category', to_category_transformer),
    ('preprocessor', preprocessor),
    ('model', model)
])

# Preprocessing of training data, train model 
clf.fit(X_train, y_train)

# Preprocessing of validation data, get predictions
preds = clf.predict(X_test)

# Evaluate the model
score = accuracy_score(y_test, preds)
print('Accuracy:', score)

```

### Expected Results

Accuracy: 0.9

### Actual Results

```python-traceback
Traceback (most recent call last):
  Cell In[3], line 60
    clf.fit(X_train, y_train)
  File ~/code/scikit-learn/sklearn/base.py:1215 in wrapper
    return fit_method(estimator, *args, **kwargs)
  File ~/code/scikit-learn/sklearn/pipeline.py:468 in fit
    self._final_estimator.fit(Xt, y, **last_step_params["fit"])
  File ~/mambaforge/envs/dev/lib/python3.11/site-packages/lightgbm/sklearn.py:1142 in fit
    super().fit(
  File ~/mambaforge/envs/dev/lib/python3.11/site-packages/lightgbm/sklearn.py:770 in fit
    _X, _y = _LGBMCheckXY(X, y, accept_sparse=True, force_all_finite=False, ensure_min_samples=2)
  File ~/code/scikit-learn/sklearn/utils/validation.py:1150 in check_X_y
    X = check_array(
  File ~/code/scikit-learn/sklearn/utils/validation.py:919 in check_array
    array = _asarray_with_order(array, order=order, dtype=dtype, xp=xp)
  File ~/code/scikit-learn/sklearn/utils/_array_api.py:543 in _asarray_with_order
    array = numpy.asarray(array, order=order, dtype=dtype)
ValueError: could not convert string to float: 'male'
```

### Versions

```shell
1.2.2
```

COMMENT:
With your pipeline, you can get the input data that you required by requesting a dataframe as output of the transfomers. You need to add:

```python
import sklearn
sklearn.set_config(set_output="pandas")
```

You will get the expected input:

```python
In [6]: clf[:-1].fit_transform(X_train)
Out[6]: 
     num__Pclass  num__Age  num__Siblings/Spouses Aboard  num__Parents/Children Aboard  num__Fare remainder__Sex
422     0.823649  1.726715                     -0.463130                     -0.477609  -0.494246           male
370     0.823649 -0.738975                     -0.463130                     -0.477609  -0.479237           male
312    -0.374878  0.951784                      0.409339                      0.792831  -0.137777           male
2       0.823649 -0.245837                     -0.463130                     -0.477609  -0.481582         female
408     0.823649  0.881336                     -0.463130                     -0.477609  -0.482130           male
..           ...       ...                           ...                           ...        ...            ...
106     0.823649 -0.034492                     -0.463130                     -0.477609  -0.484396           male
270    -0.374878  0.810887                     -0.463130                      0.792831  -0.264418         female
860    -0.374878 -0.386734                     -0.463130                     -0.477609  -0.386367           male
435    -1.573405  2.431198                      0.409339                      4.604152   4.304009           male
102     0.823649  0.247301                     -0.463130                     -0.477609  -0.467901           male

[665 rows x 6 columns]

In [7]: clf[:-1].fit_transform(X_train).info()
<class 'pandas.core.frame.DataFrame'>
Index: 665 entries, 422 to 102
Data columns (total 6 columns):
 #   Column                        Non-Null Count  Dtype   
---  ------                        --------------  -----   
 0   num__Pclass                   665 non-null    float64 
 1   num__Age                      665 non-null    float64 
 2   num__Siblings/Spouses Aboard  665 non-null    float64 
 3   num__Parents/Children Aboard  665 non-null    float64 
 4   num__Fare                     665 non-null    float64 
 5   remainder__Sex                665 non-null    category
dtypes: category(1), float64(5)
memory usage: 31.9 KB
```

This will only work because you are using a `FunctionTransformer` that will not convert the data into a NumPy array.

Labels: Bug