使对象变粘似乎不起作用

时间:2019-11-09 18:00:25

标签: css sticky

我一直在尝试在右侧贴上图像,而人们可以在左侧滚动显示艺术家姓名,但由于左侧已经滚动,因此可能无法正常工作。这是我正在尝试的页面:

https://aarongalleries.com/test-page/

我的位置是:在我的CSS中粘贴为:

div#hot-random_image-2 {
position: -webkit-sticky !important;
position: sticky !important;
top: 50px !important;
}

Thx。

1 个答案:

答案 0 :(得分:1)

请尝试以下代码

def dl_model(deep_df): # deep_df is a dataframe
    deep_feat = deep_df.drop(columns=["target"], axis=1)
    deep_label = deep_df["target"]
    categorical_columns = [col for col in deep_feat.columns if len(deep_feat[col].unique())==2 or deep_feat[col].dtype=='O']
    continuous_columns = [col for col in deep_feat.columns if len(deep_feat[col].unique()) > 2 and (
                deep_feat[col].dtype == 'int64' or deep_feat[col].dtype == 'float64')]
    X_T, X_t, y_T, y_t = train_test_split(deep_feat, deep_label, test_size=0.3)
    cols_to_scale = continuous_columns[:]
    cols_to_scale.remove("age")
    scaler = StandardScaler()
    X_T.loc[:, cols_to_scale] = scaler.fit_transform(X_T.loc[:, cols_to_scale])
    X_t.loc[:, cols_to_scale] = scaler.fit_transform(X_t.loc[:, cols_to_scale])
    categorical_object_feat_cols = [tf.feature_column.embedding_column(
        tf.feature_column.categorical_column_with_hash_bucket(key=col, hash_bucket_size=1000),
        dimension=len(deep_df[col].unique())) for col in categorical_columns if deep_df[col].dtype == 'O']
    categorical_integer_feat_cols = [
        tf.feature_column.embedding_column(tf.feature_column.categorical_column_with_identity(key=col, num_buckets=2),
                                           dimension=len(deep_df[col].unique())) for col in categorical_columns if deep_df[col].dtype == 'int64']
    continuous_feat_cols = [tf.feature_column.numeric_column(key=col) for col in continuous_columns if col != "age"]
    age_bucket = tf.feature_column.bucketized_column(tf.feature_column.numeric_column(key="age"),
                                                     boundaries=[20, 30, 40, 50, 60, 70, 80, 90])
    feat_cols = categorical_object_feat_cols + \
                categorical_integer_feat_cols + \
                continuous_feat_cols + \
                [age_bucket]

    input_fun = tf.compat.v1.estimator.inputs.pandas_input_fn(X_T, y_T, batch_size=50, num_epochs=1000, shuffle=True)
    pred_input_fun = tf.compat.v1.estimator.inputs.pandas_input_fn(X_t, batch_size=50, shuffle=False)
    DNN_model = tf.estimator.DNNClassifier(hidden_units=[10, 10, 10], feature_columns=feat_cols, n_classes=2)
    DNN_model.train(input_fn=input_fun, steps=5000)
    predictions = DNN_model.predict(pred_input_fun)
    res_pred = list(predictions)
    y_pred = []
    for i in range(len(res_pred)):
        y_pred.append(res_pred[i]["class_ids"][0])
    rep = classification_report(y_t, y_pred)
    print(rep)

    new_data = pd.read_csv("test.csv")
    predictions = DNN_model.predict(new_data) # my predictions

    print(predictions)
相关问题